[JBoss JIRA] (TEIID-2864) With select fails on Teiid 8.7-beta1 on MS SQL Server
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-2864?page=com.atlassian.jira.plugin... ]
Steven Hawkins updated TEIID-2864:
----------------------------------
Issue Type: Bug (was: Feature Request)
Fix Version/s: 8.7
Affects Version/s: 8.4
(was: 8.7)
Component/s: JDBC Connector
> With select fails on Teiid 8.7-beta1 on MS SQL Server
> -----------------------------------------------------
>
> Key: TEIID-2864
> URL: https://issues.jboss.org/browse/TEIID-2864
> Project: Teiid
> Issue Type: Bug
> Components: JDBC Connector
> Affects Versions: 8.4
> Reporter: Alex K.
> Assignee: Steven Hawkins
> Fix For: 8.7
>
>
> following query fails for me on Teiid 8.7-beta1 on MS SQL Server in queries containing WITH, UNION ALL and LIMIT clauses (The exception is being thrown only when having LIMIT clause, without the LIMIT it seems working)
> {code:sql}
> WITH qry_0 as
> (SELECT t1.f a FROM test_tables_ms.test_e AS t1 GROUP BY t1.f)
> SELECT a as a1 from qry_0
> union all
> SELECT a from qry_0
> LIMIT 10
> {code}
> Exception:
> {code:java}
> WARN [org.teiid.CONNECTOR] (Worker5_QueryProcessorQueue30) beKbgt/pu4f4 Connector worker process failed for atomic-request=beKbgt/pu4f4.11.2.6: org.teiid.translator.jdbc.JDBCExecutionException: 156 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT TOP 10 * FROM (WITH qry_0 (a) AS (SELECT g_0."f" FROM "test_tables"."dbo"."test_e" g_0 GROUP BY g_0."f") SELECT g_1.a AS c_0 FROM qry_0 g_1 UNION ALL SELECT g_0.a AS c_0 FROM qry_0 g_0) AS X]
> at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:131)
> at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:317) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:298) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:110) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:107) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_25]
> at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_25]
> at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:58) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
> at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'WITH'.
> at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
> at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
> at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
> at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
> at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:123)
> ... 13 more
> 19:23:44,606 WARN [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue31) beKbgt/pu4f4 TEIID30020 Processing exception for request beKbgt/pu4f4.11 'TEIID30504 test_tables_ms: 156 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT TOP 10 * FROM (WITH qry_0 (a) AS (SELECT g_0."f" FROM "test_tables"."dbo"."test_e" g_0 GROUP BY g_0."f") SELECT g_1.a AS c_0 FROM qry_0 g_1 UNION ALL SELECT g_0.a AS c_0 FROM qry_0 g_0) AS X]'. Originally TeiidProcessingException 'Incorrect syntax near the keyword 'WITH'.' SQLServerException.java:216. Enable more detailed logging to see the entire stacktrace.
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
10 years, 10 months
[JBoss JIRA] (TEIID-2864) With select fails on Teiid 8.7-beta1 on MS SQL Server
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-2864?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-2864.
-----------------------------------
Resolution: Done
Both SQL Server and Oracle queries need to use inline views at times, but were not considering the proper placement of the with clause. Now both elevate the with clause.
> With select fails on Teiid 8.7-beta1 on MS SQL Server
> -----------------------------------------------------
>
> Key: TEIID-2864
> URL: https://issues.jboss.org/browse/TEIID-2864
> Project: Teiid
> Issue Type: Bug
> Components: JDBC Connector
> Affects Versions: 8.4
> Reporter: Alex K.
> Assignee: Steven Hawkins
> Fix For: 8.7
>
>
> following query fails for me on Teiid 8.7-beta1 on MS SQL Server in queries containing WITH, UNION ALL and LIMIT clauses (The exception is being thrown only when having LIMIT clause, without the LIMIT it seems working)
> {code:sql}
> WITH qry_0 as
> (SELECT t1.f a FROM test_tables_ms.test_e AS t1 GROUP BY t1.f)
> SELECT a as a1 from qry_0
> union all
> SELECT a from qry_0
> LIMIT 10
> {code}
> Exception:
> {code:java}
> WARN [org.teiid.CONNECTOR] (Worker5_QueryProcessorQueue30) beKbgt/pu4f4 Connector worker process failed for atomic-request=beKbgt/pu4f4.11.2.6: org.teiid.translator.jdbc.JDBCExecutionException: 156 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT TOP 10 * FROM (WITH qry_0 (a) AS (SELECT g_0."f" FROM "test_tables"."dbo"."test_e" g_0 GROUP BY g_0."f") SELECT g_1.a AS c_0 FROM qry_0 g_1 UNION ALL SELECT g_0.a AS c_0 FROM qry_0 g_0) AS X]
> at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:131)
> at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:317) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:298) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:110) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:107) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_25]
> at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_25]
> at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:58) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
> at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
> Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'WITH'.
> at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
> at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
> at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
> at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
> at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
> at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
> at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:123)
> ... 13 more
> 19:23:44,606 WARN [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue31) beKbgt/pu4f4 TEIID30020 Processing exception for request beKbgt/pu4f4.11 'TEIID30504 test_tables_ms: 156 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT TOP 10 * FROM (WITH qry_0 (a) AS (SELECT g_0."f" FROM "test_tables"."dbo"."test_e" g_0 GROUP BY g_0."f") SELECT g_1.a AS c_0 FROM qry_0 g_1 UNION ALL SELECT g_0.a AS c_0 FROM qry_0 g_0) AS X]'. Originally TeiidProcessingException 'Incorrect syntax near the keyword 'WITH'.' SQLServerException.java:216. Enable more detailed logging to see the entire stacktrace.
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
10 years, 10 months
[JBoss JIRA] (TEIID-2864) With select fails on Teiid 8.7-beta1 on MS SQL Server
by Alex K. (JIRA)
Alex K. created TEIID-2864:
------------------------------
Summary: With select fails on Teiid 8.7-beta1 on MS SQL Server
Key: TEIID-2864
URL: https://issues.jboss.org/browse/TEIID-2864
Project: Teiid
Issue Type: Feature Request
Affects Versions: 8.7
Reporter: Alex K.
Assignee: Steven Hawkins
following query fails for me on Teiid 8.7-beta1 on MS SQL Server in queries containing WITH, UNION ALL and LIMIT clauses (The exception is being thrown only when having LIMIT clause, without the LIMIT it seems working)
{code:sql}
WITH qry_0 as
(SELECT t1.f a FROM test_tables_ms.test_e AS t1 GROUP BY t1.f)
SELECT a as a1 from qry_0
union all
SELECT a from qry_0
LIMIT 10
{code}
Exception:
{code:java}
WARN [org.teiid.CONNECTOR] (Worker5_QueryProcessorQueue30) beKbgt/pu4f4 Connector worker process failed for atomic-request=beKbgt/pu4f4.11.2.6: org.teiid.translator.jdbc.JDBCExecutionException: 156 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT TOP 10 * FROM (WITH qry_0 (a) AS (SELECT g_0."f" FROM "test_tables"."dbo"."test_e" g_0 GROUP BY g_0."f") SELECT g_1.a AS c_0 FROM qry_0 g_1 UNION ALL SELECT g_0.a AS c_0 FROM qry_0 g_0) AS X]
at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:131)
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:317) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:298) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:110) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:107) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_25]
at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_25]
at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:58) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.7.0.Beta1.jar:8.7.0.Beta1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'WITH'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
at org.teiid.translator.jdbc.JDBCQueryExecution.execute(JDBCQueryExecution.java:123)
... 13 more
19:23:44,606 WARN [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue31) beKbgt/pu4f4 TEIID30020 Processing exception for request beKbgt/pu4f4.11 'TEIID30504 test_tables_ms: 156 TEIID11008:TEIID11004 Error executing statement(s): [Prepared Values: [] SQL: SELECT TOP 10 * FROM (WITH qry_0 (a) AS (SELECT g_0."f" FROM "test_tables"."dbo"."test_e" g_0 GROUP BY g_0."f") SELECT g_1.a AS c_0 FROM qry_0 g_1 UNION ALL SELECT g_0.a AS c_0 FROM qry_0 g_0) AS X]'. Originally TeiidProcessingException 'Incorrect syntax near the keyword 'WITH'.' SQLServerException.java:216. Enable more detailed logging to see the entire stacktrace.
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
10 years, 10 months
[JBoss JIRA] (TEIID-2861) Partitioned UNION query fails
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-2861?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-2861.
-----------------------------------
Resolution: Duplicate Issue
Also logged as TEIID-2862
> Partitioned UNION query fails
> -----------------------------
>
> Key: TEIID-2861
> URL: https://issues.jboss.org/browse/TEIID-2861
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 8.6
> Reporter: Tom Arnold
> Assignee: Steven Hawkins
> Labels: 8.6, oracle, partitioned, query, union
>
> I have a query like this where FOO and BAR are two different Oracle databases.
> {code:sql}
> select * from (
> (select item_id, created_at, 'Foo' source from foo.items order by created_at desc limit 5000)
> union all
> (select item_id, created_at, 'Bar' source from bar.items order by created_at desc limit 5000)
> ) x
> where
> source in ('Foo', 'Bar')
> order by created_at desc
> limit 0, 500;
> {code}
> If I adjust the filter to only include results from the second query, I get an exception.
> {code}
> 09:15:19,287 ERROR [org.teiid.PROCESSOR] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU TEIID30019 Unexpected exception for request 7rl0TEA59SdU.7: java.lang.ArrayIndexOutOfBoundsException: -1
> at java.util.ArrayList.elementData(ArrayList.java:400) [rt.jar:1.7.0_51]
> at java.util.ArrayList.get(ArrayList.java:413) [rt.jar:1.7.0_51]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:170) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:70) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:606) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:255) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:408) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.processRequest(Request.java:435) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:600) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:309) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:248) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
> at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
> {code}
> I noticed that if I remove the ORDER BY from the BAR query it seems to work (although obviously not the results I want).
> Here is the debug plan.
> {code}
> 09:15:19,265 DEBUG [org.teiid.COMMAND_LOG] (New I/O worker #2) 7rl0TEA59SdU START USER COMMAND: startTime=2014-02-24 09:15:19.264 requestID=7rl0TEA59SdU.7 txID=null sessionID=7rl0TEA59SdU applicationName=JDBCprincipal=user@teiid-security vdbName=Foo vdbVersion=1 sql=select * from (
> (select item_id, created_at, 'Foo' source from foo.products order by created_at desc limit 5000)
> union all
> (select item_id, created_at, 'Bar' source from bar.products order by created_at desc limit 5000)
> ) x
> where
> source in ('Bar')
> order by created_at desc
> limit 0, 500
> 09:15:19,279 INFO [org.teiid.PLANNER] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU
> ============================================================================
> USER COMMAND:
> SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
>
> ----------------------------------------------------------------------------
> OPTIMIZE:
> SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
>
> ----------------------------------------------------------------------------
> GENERATE CANONICAL:
> SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
>
> CANONICAL PLAN:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500})
> Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC})
> Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar'})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT, x.source='Foo'}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source]})
> Source(groups=[foo.ITEMS])
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source]})
> Source(groups=[bar.ITEMS])
>
> ============================================================================
> EXECUTING PlaceAccess
>
> AFTER:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500})
> Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC})
> Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar'})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT, x.source='Foo'}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source]})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000})
> Source(groups=[foo.ITEMS])
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source]})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000})
> Source(groups=[bar.ITEMS])
>
> ============================================================================
> EXECUTING AssignOutputElements
>
> AFTER:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source], OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar', OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.source='Foo', x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}, OUTPUT_COLS=[x.source, x.ITEM_ID, x.CREATED_AT]})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Source(groups=[foo.ITEMS], props={OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Source(groups=[bar.ITEMS], props={OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
>
> ============================================================================
> EXECUTING PushSelectCriteria
>
> AFTER:
> TupleLimit(groups=[])
> Sort(groups=[x])
> Project(groups=[x])
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar', OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source], IS_PHANTOM=true})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.source='Foo', x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}, OUTPUT_COLS=[x.source, x.ITEM_ID, x.CREATED_AT]})
> SetOperation(groups=[])
> TupleLimit(groups=[])
> Sort(groups=[foo.ITEMS])
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Select(groups=[], props={SELECT_CRITERIA=1 = 0})
> Source(groups=[foo.ITEMS], props={OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[])
> Sort(groups=[bar.ITEMS])
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Select(groups=[], props={SELECT_CRITERIA=1 = 1})
> Source(groups=[bar.ITEMS], props={OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
>
> ============================================================================
> EXECUTING MergeVirtual
>
> AFTER:
> TupleLimit(groups=[])
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[])
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Access(groups=[foo.ITEMS])
> Select(groups=[])
> Source(groups=[foo.ITEMS])
> TupleLimit(groups=[])
> Sort(groups=[bar.ITEMS])
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Access(groups=[bar.ITEMS])
> Select(groups=[])
> Source(groups=[bar.ITEMS])
>
> ============================================================================
> EXECUTING CleanCriteria
>
> AFTER:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500, OUTPUT_COLS=null})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=null})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=null})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source], OUTPUT_COLS=null})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=null})
> Null(groups=[foo.ITEMS])
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=null})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source], OUTPUT_COLS=null})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=null})
> Source(groups=[bar.ITEMS], props={OUTPUT_COLS=null})
>
> ============================================================================
> EXECUTING RaiseNull
>
> 09:15:19,286 DEBUG [org.teiid.COMMAND_LOG] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU ERROR USER COMMAND: endTime=2014-02-24 09:15:19.286 requestID=7rl0TEA59SdU.7 txID=null sessionID=7rl0TEA59SdU principal=user@teiid-security vdbName=Foo vdbVersion=1 finalRowCount=null
> 09:15:19,287 ERROR [org.teiid.PROCESSOR] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU TEIID30019 Unexpected exception for request 7rl0TEA59SdU.7: java.lang.ArrayIndexOutOfBoundsException: -1
> at java.util.ArrayList.elementData(ArrayList.java:400) [rt.jar:1.7.0_51]
> at java.util.ArrayList.get(ArrayList.java:413) [rt.jar:1.7.0_51]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:170) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:70) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:606) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:255) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:408) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.processRequest(Request.java:435) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:600) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:309) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:248) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
> at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
10 years, 10 months
[JBoss JIRA] (TEIID-2862) index out of bounds when a union branch with limit/order by is removed
by Steven Hawkins (JIRA)
Steven Hawkins created TEIID-2862:
-------------------------------------
Summary: index out of bounds when a union branch with limit/order by is removed
Key: TEIID-2862
URL: https://issues.jboss.org/browse/TEIID-2862
Project: Teiid
Issue Type: Bug
Components: Query Engine
Affects Versions: 7.7
Reporter: Steven Hawkins
Assignee: Steven Hawkins
Fix For: 8.7
When the first union branch is removed and the other branch contains a limit/order by, then the logic that should be updating the parent order by instead uses the child. This results in an index out of bounds exception.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
10 years, 10 months
[JBoss JIRA] (TEIID-2861) Partitioned UNION query fails
by Tom Arnold (JIRA)
[ https://issues.jboss.org/browse/TEIID-2861?page=com.atlassian.jira.plugin... ]
Tom Arnold updated TEIID-2861:
------------------------------
Description:
I have a query like this where FOO and BAR are two different Oracle databases.
{code:sql}
select * from (
(select item_id, created_at, 'Foo' source from foo.items order by created_at desc limit 5000)
union all
(select item_id, created_at, 'Bar' source from bar.items order by created_at desc limit 5000)
) x
where
source in ('Foo', 'Bar')
order by created_at desc
limit 0, 500;
{code}
If I adjust the filter to only include results from the second query, I get an exception.
{code}
09:15:19,287 ERROR [org.teiid.PROCESSOR] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU TEIID30019 Unexpected exception for request 7rl0TEA59SdU.7: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:400) [rt.jar:1.7.0_51]
at java.util.ArrayList.get(ArrayList.java:413) [rt.jar:1.7.0_51]
at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:170) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:70) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:606) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:255) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:408) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.Request.processRequest(Request.java:435) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:600) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:309) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:248) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
{code}
I noticed that if I remove the ORDER BY from the BAR query it seems to work (although obviously not the results I want).
Here is the debug plan.
{code}
09:15:19,265 DEBUG [org.teiid.COMMAND_LOG] (New I/O worker #2) 7rl0TEA59SdU START USER COMMAND: startTime=2014-02-24 09:15:19.264 requestID=7rl0TEA59SdU.7 txID=null sessionID=7rl0TEA59SdU applicationName=JDBCprincipal=user@teiid-security vdbName=Foo vdbVersion=1 sql=select * from (
(select item_id, created_at, 'Foo' source from foo.products order by created_at desc limit 5000)
union all
(select item_id, created_at, 'Bar' source from bar.products order by created_at desc limit 5000)
) x
where
source in ('Bar')
order by created_at desc
limit 0, 500
09:15:19,279 INFO [org.teiid.PLANNER] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU
============================================================================
USER COMMAND:
SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
----------------------------------------------------------------------------
OPTIMIZE:
SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
----------------------------------------------------------------------------
GENERATE CANONICAL:
SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
CANONICAL PLAN:
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500})
Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC})
Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar'})
Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT, x.source='Foo'}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}})
SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true})
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC})
Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source]})
Source(groups=[foo.ITEMS])
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC})
Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source]})
Source(groups=[bar.ITEMS])
============================================================================
EXECUTING PlaceAccess
AFTER:
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500})
Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC})
Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar'})
Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT, x.source='Foo'}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}})
SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true})
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC})
Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source]})
Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000})
Source(groups=[foo.ITEMS])
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC})
Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source]})
Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000})
Source(groups=[bar.ITEMS])
============================================================================
EXECUTING AssignOutputElements
AFTER:
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source], OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar', OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.source='Foo', x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}, OUTPUT_COLS=[x.source, x.ITEM_ID, x.CREATED_AT]})
SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Project(groups=[foo.ITEMS], props={PROJECT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Source(groups=[foo.ITEMS], props={OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
Project(groups=[bar.ITEMS], props={PROJECT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
Source(groups=[bar.ITEMS], props={OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
============================================================================
EXECUTING PushSelectCriteria
AFTER:
TupleLimit(groups=[])
Sort(groups=[x])
Project(groups=[x])
Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar', OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source], IS_PHANTOM=true})
Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.source='Foo', x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}, OUTPUT_COLS=[x.source, x.ITEM_ID, x.CREATED_AT]})
SetOperation(groups=[])
TupleLimit(groups=[])
Sort(groups=[foo.ITEMS])
Project(groups=[foo.ITEMS], props={PROJECT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Select(groups=[], props={SELECT_CRITERIA=1 = 0})
Source(groups=[foo.ITEMS], props={OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
TupleLimit(groups=[])
Sort(groups=[bar.ITEMS])
Project(groups=[bar.ITEMS], props={PROJECT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
Select(groups=[], props={SELECT_CRITERIA=1 = 1})
Source(groups=[bar.ITEMS], props={OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
============================================================================
EXECUTING MergeVirtual
AFTER:
TupleLimit(groups=[])
Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
TupleLimit(groups=[])
Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
Access(groups=[foo.ITEMS])
Select(groups=[])
Source(groups=[foo.ITEMS])
TupleLimit(groups=[])
Sort(groups=[bar.ITEMS])
Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
Access(groups=[bar.ITEMS])
Select(groups=[])
Source(groups=[bar.ITEMS])
============================================================================
EXECUTING CleanCriteria
AFTER:
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500, OUTPUT_COLS=null})
Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=null})
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=null})
Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source], OUTPUT_COLS=null})
Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=null})
Null(groups=[foo.ITEMS])
TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=null})
Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source], OUTPUT_COLS=null})
Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=null})
Source(groups=[bar.ITEMS], props={OUTPUT_COLS=null})
============================================================================
EXECUTING RaiseNull
09:15:19,286 DEBUG [org.teiid.COMMAND_LOG] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU ERROR USER COMMAND: endTime=2014-02-24 09:15:19.286 requestID=7rl0TEA59SdU.7 txID=null sessionID=7rl0TEA59SdU principal=user@teiid-security vdbName=Foo vdbVersion=1 finalRowCount=null
09:15:19,287 ERROR [org.teiid.PROCESSOR] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU TEIID30019 Unexpected exception for request 7rl0TEA59SdU.7: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:400) [rt.jar:1.7.0_51]
at java.util.ArrayList.get(ArrayList.java:413) [rt.jar:1.7.0_51]
at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:170) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:70) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:606) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:255) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:408) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.Request.processRequest(Request.java:435) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:600) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:309) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:248) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
{code}
was:
I have a query like this where FOO and BAR are two different Oracle databases.
select * from (
(select item_id, created_at, 'Foo' source from foo.items order by created_at desc limit 5000)
union all
(select item_id, created_at, 'Bar' source from bar.items order by created_at desc limit 5000)
) x
where
source in ('Foo', 'Bar')
order by created_at desc
limit 0, 500;
If I adjust the filter to only include results from the second query, I get an exception.
09:15:19,287 ERROR [org.teiid.PROCESSOR] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU TEIID30019 Unexpected exception for request 7rl0TEA59SdU.7: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:400) [rt.jar:1.7.0_51]
at java.util.ArrayList.get(ArrayList.java:413) [rt.jar:1.7.0_51]
at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:170) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:70) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:606) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:255) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:408) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.Request.processRequest(Request.java:435) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:600) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:309) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:248) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
> Partitioned UNION query fails
> -----------------------------
>
> Key: TEIID-2861
> URL: https://issues.jboss.org/browse/TEIID-2861
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 8.6
> Reporter: Tom Arnold
> Assignee: Steven Hawkins
> Labels: 8.6, oracle, partitioned, query, union
>
> I have a query like this where FOO and BAR are two different Oracle databases.
> {code:sql}
> select * from (
> (select item_id, created_at, 'Foo' source from foo.items order by created_at desc limit 5000)
> union all
> (select item_id, created_at, 'Bar' source from bar.items order by created_at desc limit 5000)
> ) x
> where
> source in ('Foo', 'Bar')
> order by created_at desc
> limit 0, 500;
> {code}
> If I adjust the filter to only include results from the second query, I get an exception.
> {code}
> 09:15:19,287 ERROR [org.teiid.PROCESSOR] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU TEIID30019 Unexpected exception for request 7rl0TEA59SdU.7: java.lang.ArrayIndexOutOfBoundsException: -1
> at java.util.ArrayList.elementData(ArrayList.java:400) [rt.jar:1.7.0_51]
> at java.util.ArrayList.get(ArrayList.java:413) [rt.jar:1.7.0_51]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:170) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:70) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:606) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:255) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:408) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.processRequest(Request.java:435) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:600) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:309) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:248) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
> at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
> {code}
> I noticed that if I remove the ORDER BY from the BAR query it seems to work (although obviously not the results I want).
> Here is the debug plan.
> {code}
> 09:15:19,265 DEBUG [org.teiid.COMMAND_LOG] (New I/O worker #2) 7rl0TEA59SdU START USER COMMAND: startTime=2014-02-24 09:15:19.264 requestID=7rl0TEA59SdU.7 txID=null sessionID=7rl0TEA59SdU applicationName=JDBCprincipal=user@teiid-security vdbName=Foo vdbVersion=1 sql=select * from (
> (select item_id, created_at, 'Foo' source from foo.products order by created_at desc limit 5000)
> union all
> (select item_id, created_at, 'Bar' source from bar.products order by created_at desc limit 5000)
> ) x
> where
> source in ('Bar')
> order by created_at desc
> limit 0, 500
> 09:15:19,279 INFO [org.teiid.PLANNER] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU
> ============================================================================
> USER COMMAND:
> SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
>
> ----------------------------------------------------------------------------
> OPTIMIZE:
> SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
>
> ----------------------------------------------------------------------------
> GENERATE CANONICAL:
> SELECT * FROM ((SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000)) AS x WHERE x.source = 'Bar' ORDER BY x.CREATED_AT DESC LIMIT 500
>
> CANONICAL PLAN:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500})
> Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC})
> Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar'})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT, x.source='Foo'}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source]})
> Source(groups=[foo.ITEMS])
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source]})
> Source(groups=[bar.ITEMS])
>
> ============================================================================
> EXECUTING PlaceAccess
>
> AFTER:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500})
> Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC})
> Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar'})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT, x.source='Foo'}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source]})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000})
> Source(groups=[foo.ITEMS])
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source]})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000})
> Source(groups=[bar.ITEMS])
>
> ============================================================================
> EXECUTING AssignOutputElements
>
> AFTER:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Sort(groups=[x], props={SORT_ORDER=ORDER BY x.CREATED_AT DESC, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Project(groups=[x], props={PROJECT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source], OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar', OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.source='Foo', x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}, OUTPUT_COLS=[x.source, x.ITEM_ID, x.CREATED_AT]})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Source(groups=[foo.ITEMS], props={OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Source(groups=[bar.ITEMS], props={OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
>
> ============================================================================
> EXECUTING PushSelectCriteria
>
> AFTER:
> TupleLimit(groups=[])
> Sort(groups=[x])
> Project(groups=[x])
> Select(groups=[x], props={SELECT_CRITERIA=x.source = 'Bar', OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source], IS_PHANTOM=true})
> Source(groups=[x], props={NESTED_COMMAND=(SELECT foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source FROM foo.ITEMS ORDER BY foo.ITEMS.CREATED_AT DESC LIMIT 5000) UNION ALL (SELECT bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source FROM bar.ITEMS ORDER BY bar.ITEMS.CREATED_AT DESC LIMIT 5000), SYMBOL_MAP={x.source='Foo', x.ITEM_ID=foo.ITEMS.ITEM_ID, x.CREATED_AT=foo.ITEMS.CREATED_AT}, PARTITION_INFO={x.source=[['Foo'], ['Bar']]}, OUTPUT_COLS=[x.source, x.ITEM_ID, x.CREATED_AT]})
> SetOperation(groups=[])
> TupleLimit(groups=[])
> Sort(groups=[foo.ITEMS])
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Select(groups=[], props={SELECT_CRITERIA=1 = 0})
> Source(groups=[foo.ITEMS], props={OUTPUT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[])
> Sort(groups=[bar.ITEMS])
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Select(groups=[], props={SELECT_CRITERIA=1 = 1})
> Source(groups=[bar.ITEMS], props={OUTPUT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
>
> ============================================================================
> EXECUTING MergeVirtual
>
> AFTER:
> TupleLimit(groups=[])
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=[x.ITEM_ID, x.CREATED_AT, x.source]})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> TupleLimit(groups=[])
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source], OUTPUT_COLS=['Foo' AS source, foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT]})
> Access(groups=[foo.ITEMS])
> Select(groups=[])
> Source(groups=[foo.ITEMS])
> TupleLimit(groups=[])
> Sort(groups=[bar.ITEMS])
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source], OUTPUT_COLS=['Bar' AS source, bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT]})
> Access(groups=[bar.ITEMS])
> Select(groups=[])
> Source(groups=[bar.ITEMS])
>
> ============================================================================
> EXECUTING CleanCriteria
>
> AFTER:
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=500, OUTPUT_COLS=null})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
> SetOperation(groups=[], props={SET_OPERATION=UNION, USE_ALL=true, OUTPUT_COLS=null})
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=null})
> Sort(groups=[foo.ITEMS], props={SORT_ORDER=ORDER BY foo.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
> Project(groups=[foo.ITEMS], props={PROJECT_COLS=[foo.ITEMS.ITEM_ID, foo.ITEMS.CREATED_AT, 'Foo' AS source], OUTPUT_COLS=null})
> Access(groups=[foo.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=foo, nameInSource=null, uuid=tid:3af63e7dfae5-000194c4-00000000, OUTPUT_COLS=null})
> Null(groups=[foo.ITEMS])
> TupleLimit(groups=[], props={MAX_TUPLE_LIMIT=5000, OUTPUT_COLS=null})
> Sort(groups=[bar.ITEMS], props={SORT_ORDER=ORDER BY bar.ITEMS.CREATED_AT DESC, OUTPUT_COLS=null})
> Project(groups=[bar.ITEMS], props={PROJECT_COLS=[bar.ITEMS.ITEM_ID, bar.ITEMS.CREATED_AT, 'Bar' AS source], OUTPUT_COLS=null})
> Access(groups=[bar.ITEMS], props={SOURCE_HINT=null, MODEL_ID=Schema name=bar, nameInSource=null, uuid=tid:7079feeb259f-00259c3e-00000000, OUTPUT_COLS=null})
> Source(groups=[bar.ITEMS], props={OUTPUT_COLS=null})
>
> ============================================================================
> EXECUTING RaiseNull
>
> 09:15:19,286 DEBUG [org.teiid.COMMAND_LOG] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU ERROR USER COMMAND: endTime=2014-02-24 09:15:19.286 requestID=7rl0TEA59SdU.7 txID=null sessionID=7rl0TEA59SdU principal=user@teiid-security vdbName=Foo vdbVersion=1 finalRowCount=null
> 09:15:19,287 ERROR [org.teiid.PROCESSOR] (Worker5_QueryProcessorQueue50) 7rl0TEA59SdU TEIID30019 Unexpected exception for request 7rl0TEA59SdU.7: java.lang.ArrayIndexOutOfBoundsException: -1
> at java.util.ArrayList.elementData(ArrayList.java:400) [rt.jar:1.7.0_51]
> at java.util.ArrayList.get(ArrayList.java:413) [rt.jar:1.7.0_51]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:170) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:70) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:606) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:255) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:408) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.Request.processRequest(Request.java:435) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:600) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:309) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:248) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:273) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:214) [teiid-engine-8.6.0.Final.jar:8.6.0.Final]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
> at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
10 years, 10 months