[JBoss JIRA] (TEIID-4005) Allow dependent join row value to be split
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-4005?page=com.atlassian.jira.plugin... ]
Steven Hawkins updated TEIID-4005:
----------------------------------
Description:
For some queries having a dependent join row value that spans multiple target tables should be split among those targets.
For example rather than:
(g_0.e1, g_1.e2) IN (<dependent values>))
Use the pre 8.7 form:
(g_0.e1 IN (<dependent values>)) AND (g_1.e2 IN (<dependent values>))
was:Potentially an oracle query optimization issue. Row value predicate for particular tables are more performant when splitting into two in predicates.
Summary: Allow dependent join row value to be split (was: optimization to split row value predicate into two predicates)
> Allow dependent join row value to be split
> ------------------------------------------
>
> Key: TEIID-4005
> URL: https://issues.jboss.org/browse/TEIID-4005
> Project: Teiid
> Issue Type: Enhancement
> Components: Query Engine
> Affects Versions: 8.7.4.6_2
> Reporter: Johnathon Lee
> Assignee: Steven Hawkins
> Fix For: 9.0, 8.12.5
>
>
> For some queries having a dependent join row value that spans multiple target tables should be split among those targets.
> For example rather than:
> (g_0.e1, g_1.e2) IN (<dependent values>))
> Use the pre 8.7 form:
> (g_0.e1 IN (<dependent values>)) AND (g_1.e2 IN (<dependent values>))
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (TEIID-4005) Allow dependent join row value to be split
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-4005?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-4005.
-----------------------------------
Fix Version/s: 9.0
8.12.5
Resolution: Done
Added logic that will split the row comparison by target table.
> Allow dependent join row value to be split
> ------------------------------------------
>
> Key: TEIID-4005
> URL: https://issues.jboss.org/browse/TEIID-4005
> Project: Teiid
> Issue Type: Enhancement
> Components: Query Engine
> Affects Versions: 8.7.4.6_2
> Reporter: Johnathon Lee
> Assignee: Steven Hawkins
> Fix For: 9.0, 8.12.5
>
>
> For some queries having a dependent join row value that spans multiple target tables should be split among those targets.
> For example rather than:
> (g_0.e1, g_1.e2) IN (<dependent values>))
> Use the pre 8.7 form:
> (g_0.e1 IN (<dependent values>)) AND (g_1.e2 IN (<dependent values>))
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (TEIID-3995) SAP HANA materialization:function loadMatView with argument invalidate set to true problem
by Jan Stastny (JIRA)
[ https://issues.jboss.org/browse/TEIID-3995?page=com.atlassian.jira.plugin... ]
Jan Stastny updated TEIID-3995:
-------------------------------
Attachment: server.log
> SAP HANA materialization:function loadMatView with argument invalidate set to true problem
> ------------------------------------------------------------------------------------------
>
> Key: TEIID-3995
> URL: https://issues.jboss.org/browse/TEIID-3995
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 8.12.x
> Reporter: Jan Stastny
> Assignee: Steven Hawkins
> Attachments: server.log
>
>
> There appears to be an issue with loadMatView function.
> Specifically when the function is invoked with invalidate=>'true' argument, when it is expected, that invocation of this function invalidates the current contents of the materialized view until the initiated load is completed and new data are populated.
> But when calling this function as described, an error occurs:
> {code:plain}
> TEIID20001 The modeled datatype integer for column 0 doesn't match the runtime type "org.teiid.core.types.ArrayImpl". Please ensure that the column's modeled datatype matches the expected data.
> {code}
> Please note, that there is no column of type array in my schema.
> There is declaration of the view:
> {code:sql}
> CREATE VIEW external_long_ttl (
> customer_id integer NOT NULL,
> total_amount integer
> )
> {code}
> and the query used to load the view:
> {code:sql}
> "teiid_rel:MATVIEW_LOAD_SCRIPT" 'INSERT INTO dv_matviews_mat_view_stage(customer_id,total_amount) SELECT CONVERT(c.id,integer) AS customer_id, CONVERT(SUM(o.amount),integer) AS total_amount FROM dv_matviews_customers c INNER JOIN dv_matviews_orders o ON c.id = o.customer_id GROUP BY c.id;',
> {code}
> Complete definition of the view is:
> {code:sql}
> CREATE VIEW external_long_ttl (
> customer_id integer NOT NULL,
> total_amount integer
> ) OPTIONS (
> MATERIALIZED 'TRUE',
> UPDATABLE 'FALSE',
> MATERIALIZED_TABLE 'Source.JSTASTNY.dv_matviews_mat_view',
> "teiid_rel:ALLOW_MATVIEW_MANAGEMENT" 'true',
> "teiid_rel:MATVIEW_STATUS_TABLE" 'Source.JSTASTNY.dv_matviews_statustable',
> "teiid_rel:ON_VDB_START_SCRIPT" 'MERGE INTO dv_matviews_check_table(id,vdb_create) SELECT id, vdb_create+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:ON_VDB_DROP_SCRIPT" 'MERGE INTO dv_matviews_check_table(id,vdb_drop) SELECT id, vdb_drop+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:MATVIEW_LOAD_SCRIPT" 'INSERT INTO dv_matviews_mat_view_stage(customer_id,total_amount) SELECT CONVERT(c.id,integer) AS customer_id, CONVERT(SUM(o.amount),integer) AS total_amount FROM dv_matviews_customers c INNER JOIN dv_matviews_orders o ON c.id = o.customer_id GROUP BY c.id;',
> "teiid_rel:MATVIEW_BEFORE_LOAD_SCRIPT" 'exec Source.native(''truncate table dv_matviews_mat_view_stage'');MERGE INTO dv_matviews_check_table(id,before_load) SELECT id, before_load+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:MATVIEW_AFTER_LOAD_SCRIPT" 'exec Source.native(''RENAME TABLE dv_matviews_mat_view_stage TO dv_matviews_mat_view_temp'');exec Source.native(''RENAME TABLE dv_matviews_mat_view TO dv_matviews_mat_view_stage'');exec Source.native(''RENAME TABLE dv_matviews_mat_view_temp TO dv_matviews_mat_view'');MERGE INTO dv_matviews_check_table(id,after_load) SELECT id, after_load+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:MATVIEW_ONERROR_ACTION" 'WAIT',
> "teiid_rel:MATVIEW_TTL" 20000
> ) AS SELECT CONVERT(c.id,integer) AS customer_id, CONVERT(SUM(o.amount),integer) AS total_amount FROM dv_matviews_customers c INNER JOIN dv_matviews_orders o ON c.id = o.customer_id GROUP BY c.id;
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (TEIID-3995) SAP HANA materialization:function loadMatView with argument invalidate set to true problem
by Jan Stastny (JIRA)
[ https://issues.jboss.org/browse/TEIID-3995?page=com.atlassian.jira.plugin... ]
Jan Stastny commented on TEIID-3995:
------------------------------------
My testcase (using h2 example, as I reproduced the issue even with h2):
{code:java}
@Test
public void externalLongTtlExplicitLoadTest()throws Exception{
Connection connection = TestUtils.getTeiidConnection("h2");
try{
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT total_amount FROM external_long_ttl WHERE customer_id=1;");
Assert.assertTrue(rs.next(),"SELECT statement on external materialized view should return some rows.");
int originalAmount = rs.getInt(1);
statement.execute("UPDATE dv_matviews_orders SET amount=amount+50 WHERE customer_id=1");
ResultSet rs2 = statement.executeQuery("SELECT total_amount FROM external_long_ttl WHERE customer_id=1");
Assert.assertTrue(rs2.next(),"SELECT statement on external materialized view should return some rows.");
int currentAmount = rs2.getInt(1);
Assert.assertTrue(originalAmount==currentAmount,"Data in materialized table shouldn't have been updated yet.");
statement.execute("exec SYSADMIN.loadMatView(schemaName=>'View',viewname=>'external_long_ttl', invalidate=>'true')");
ResultSet rs3 = statement.executeQuery("SELECT total_amount FROM external_long_ttl WHERE customer_id=1");
Assert.assertTrue(rs3.next(),"SELECT statement on external materialized view should return some rows.");
int updatedAmount = rs3.getInt(1);
Assert.assertTrue(originalAmount<updatedAmount,"Data in materialized table should have been updated already.");
statement.execute("UPDATE dv_matviews_orders SET amount=amount+50 WHERE customer_id=1");
statement.execute("exec SYSADMIN.loadMatView(schemaName=>'View',viewname=>'external_long_ttl', invalidate=>'true')");
ResultSet rs4 = statement.executeQuery("SELECT total_amount FROM external_long_ttl WHERE customer_id=1");
Assert.assertTrue(rs4.next(),"SELECT statement on external materialized view should return some rows.");
int updatedAmount2 = rs4.getInt(1);
Assert.assertTrue(updatedAmount<updatedAmount2,"Data in materialized table should have been updated already.");
}finally{
connection.close();
}
}
{code}
Server log for this testcase is in attachement.
> SAP HANA materialization:function loadMatView with argument invalidate set to true problem
> ------------------------------------------------------------------------------------------
>
> Key: TEIID-3995
> URL: https://issues.jboss.org/browse/TEIID-3995
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 8.12.x
> Reporter: Jan Stastny
> Assignee: Steven Hawkins
>
> There appears to be an issue with loadMatView function.
> Specifically when the function is invoked with invalidate=>'true' argument, when it is expected, that invocation of this function invalidates the current contents of the materialized view until the initiated load is completed and new data are populated.
> But when calling this function as described, an error occurs:
> {code:plain}
> TEIID20001 The modeled datatype integer for column 0 doesn't match the runtime type "org.teiid.core.types.ArrayImpl". Please ensure that the column's modeled datatype matches the expected data.
> {code}
> Please note, that there is no column of type array in my schema.
> There is declaration of the view:
> {code:sql}
> CREATE VIEW external_long_ttl (
> customer_id integer NOT NULL,
> total_amount integer
> )
> {code}
> and the query used to load the view:
> {code:sql}
> "teiid_rel:MATVIEW_LOAD_SCRIPT" 'INSERT INTO dv_matviews_mat_view_stage(customer_id,total_amount) SELECT CONVERT(c.id,integer) AS customer_id, CONVERT(SUM(o.amount),integer) AS total_amount FROM dv_matviews_customers c INNER JOIN dv_matviews_orders o ON c.id = o.customer_id GROUP BY c.id;',
> {code}
> Complete definition of the view is:
> {code:sql}
> CREATE VIEW external_long_ttl (
> customer_id integer NOT NULL,
> total_amount integer
> ) OPTIONS (
> MATERIALIZED 'TRUE',
> UPDATABLE 'FALSE',
> MATERIALIZED_TABLE 'Source.JSTASTNY.dv_matviews_mat_view',
> "teiid_rel:ALLOW_MATVIEW_MANAGEMENT" 'true',
> "teiid_rel:MATVIEW_STATUS_TABLE" 'Source.JSTASTNY.dv_matviews_statustable',
> "teiid_rel:ON_VDB_START_SCRIPT" 'MERGE INTO dv_matviews_check_table(id,vdb_create) SELECT id, vdb_create+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:ON_VDB_DROP_SCRIPT" 'MERGE INTO dv_matviews_check_table(id,vdb_drop) SELECT id, vdb_drop+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:MATVIEW_LOAD_SCRIPT" 'INSERT INTO dv_matviews_mat_view_stage(customer_id,total_amount) SELECT CONVERT(c.id,integer) AS customer_id, CONVERT(SUM(o.amount),integer) AS total_amount FROM dv_matviews_customers c INNER JOIN dv_matviews_orders o ON c.id = o.customer_id GROUP BY c.id;',
> "teiid_rel:MATVIEW_BEFORE_LOAD_SCRIPT" 'exec Source.native(''truncate table dv_matviews_mat_view_stage'');MERGE INTO dv_matviews_check_table(id,before_load) SELECT id, before_load+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:MATVIEW_AFTER_LOAD_SCRIPT" 'exec Source.native(''RENAME TABLE dv_matviews_mat_view_stage TO dv_matviews_mat_view_temp'');exec Source.native(''RENAME TABLE dv_matviews_mat_view TO dv_matviews_mat_view_stage'');exec Source.native(''RENAME TABLE dv_matviews_mat_view_temp TO dv_matviews_mat_view'');MERGE INTO dv_matviews_check_table(id,after_load) SELECT id, after_load+1 FROM dv_matviews_check_table WHERE id=''external_long_ttl'';',
> "teiid_rel:MATVIEW_ONERROR_ACTION" 'WAIT',
> "teiid_rel:MATVIEW_TTL" 20000
> ) AS SELECT CONVERT(c.id,integer) AS customer_id, CONVERT(SUM(o.amount),integer) AS total_amount FROM dv_matviews_customers c INNER JOIN dv_matviews_orders o ON c.id = o.customer_id GROUP BY c.id;
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (TEIID-4003) Vertica and DB2 translators use incorrect push down of WEEK function
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-4003?page=com.atlassian.jira.plugin... ]
Steven Hawkins updated TEIID-4003:
----------------------------------
Component/s: JDBC Connector
> Vertica and DB2 translators use incorrect push down of WEEK function
> --------------------------------------------------------------------
>
> Key: TEIID-4003
> URL: https://issues.jboss.org/browse/TEIID-4003
> Project: Teiid
> Issue Type: Bug
> Components: JDBC Connector
> Reporter: Andrej Šmigala
> Assignee: Steven Hawkins
> Fix For: 9.0, 8.12.5, 8.13.2
>
>
> TEIID-3282 changed the semantics of the WEEK function to use the iso behaviour.
> The Vertica database has WEEK_ISO function that returns the iso week, but the translator does not have that alias set.
> This results in the query (the datevalue in question is 2000-12-31)
> {code:sql}
> select week(datevalue) from source.largea where intkey = 365
> {code}
> to return 54, when the correct value is 52.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (TEIID-4003) Vertica and DB2 translators use incorrect push down of WEEK function
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-4003?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-4003.
-----------------------------------
Fix Version/s: 9.0
8.13.2
Resolution: Done
Applied the pull request. Thanks Andrej.
> Vertica and DB2 translators use incorrect push down of WEEK function
> --------------------------------------------------------------------
>
> Key: TEIID-4003
> URL: https://issues.jboss.org/browse/TEIID-4003
> Project: Teiid
> Issue Type: Bug
> Components: JDBC Connector
> Reporter: Andrej Šmigala
> Assignee: Steven Hawkins
> Fix For: 9.0, 8.12.5, 8.13.2
>
>
> TEIID-3282 changed the semantics of the WEEK function to use the iso behaviour.
> The Vertica database has WEEK_ISO function that returns the iso week, but the translator does not have that alias set.
> This results in the query (the datevalue in question is 2000-12-31)
> {code:sql}
> select week(datevalue) from source.largea where intkey = 365
> {code}
> to return 54, when the correct value is 52.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (TEIID-4005) optimization to split row value predicate into two predicates
by Johnathon Lee (JIRA)
Johnathon Lee created TEIID-4005:
------------------------------------
Summary: optimization to split row value predicate into two predicates
Key: TEIID-4005
URL: https://issues.jboss.org/browse/TEIID-4005
Project: Teiid
Issue Type: Enhancement
Components: Query Engine
Affects Versions: 8.7.4.6_2
Reporter: Johnathon Lee
Assignee: Steven Hawkins
Potentially an oracle query optimization issue. Row value predicate for particular tables are more performant when splitting into two in predicates.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months