[teiid-issues] [JBoss JIRA] (TEIID-5271) Joining more than one table/view to results of table function causes error, Table functions cause errors in queries containing RIGH or FULL JOINs
dalex dalex (JIRA)
issues at jboss.org
Mon Mar 5 09:50:00 EST 2018
[ https://issues.jboss.org/browse/TEIID-5271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
dalex dalex updated TEIID-5271:
-------------------------------
Steps to Reproduce:
1. Configure in the test-vdb.xml the following virtual view and procedure:
{code:xml}
<model visible = "true" type = "VIRTUAL" name = "views">
<metadata type = "DDL"><![CDATA[
create view v as select 1 a, 2 b;
create virtual procedure pr(i integer) returns (a string)as
begin
select i||'';
end
]]>
</metadata>
</model>
{code}
2. Run the following queries for the first problem (TEIID30328 Unable to evaluate x1.a: No value was available):
{code:sql}
select * from views.v x1, table(select x1.a a) x2 join views.v x3 on x2.a=x3.a join views.v x4 on x4.a=x3.a ;;
select * from views.v x1, lateral(select x1.a a) x2 join views.v x3 on x2.a=x3.a join views.v x4 on x4.a=x3.a ;;
select * from views.v x1, xmltable('/a' PASSING xmlparse(document '<a id="' || x1.a || '"/>') COLUMNS a integer PATH '@id') x2 join views.v x3 on x2.a=x3.a join views.v x4 on x4.a=x3.a ;;
{code}
was:
1. Configure in the test-vdb.xml the following virtual view and procedure:
{code:xml}
<model visible = "true" type = "VIRTUAL" name = "views">
<metadata type = "DDL"><![CDATA[
create view v as select 1 a, 2 b;
create virtual procedure pr(i integer) returns (a string)as
begin
select i||'';
end
]]>
</metadata>
</model>
{code}
2. Run the following queries for the first problem (TEIID30328 Unable to evaluate x1.a: No value was available):
{code:sql}
select * from views.v x1, table(select x1.a a) x2 join views.v x3 on x2.a=x3.a join views.v x4 on x4.a=x3.a ;;
select * from views.v x1, lateral(select x1.a a) x2 join views.v x3 on x2.a=x3.a join views.v x4 on x4.a=x3.a ;;
select * from views.v x1, xmltable('/a' PASSING xmlparse(document '<a id="' || x1.a || '"/>') COLUMNS a integer PATH '@id') x2 join views.v x3 on x2.a=x3.a join views.v x4 on x4.a=x3.a ;;
{code}
3. Run the following queries for the second problem (TEIID31119 Symbol x1.b is specified with an unknown group context):
{code:sql}
select * from views.v x1 right join table(select x1.b a) x2 on x1.a=x2.a ;;
select * from views.v x1, table(select x1.a a) x2 right join views.v x3 on x2.a=x3.a ;;
select * from views.v x1 right join lateral(select x1.b a) x2 on x1.a=x2.a ;;
select * from views.v x1, lateral(select x1.a a) x2 right join views.v x3 on x2.a=x3.a ;;
select * from views.v x1 right join texttable(x1.a||'' columns a string) x2 on x1.a=x2.a ;;
select * from views.v x1, texttable(x1.a||'' columns a string) x2 right join views.v x3 on x2.a=x3.a ;;
select * from views.v x1 right join xmltable('/a' PASSING xmlparse(document '<a id="' || x1.a || '"/>') COLUMNS a integer PATH '@id') x2 on x1.a=x2.a ;;
select * from views.v x1, xmltable('/a' PASSING xmlparse(document '<a id="' || x1.a || '"/>') COLUMNS a integer PATH '@id') x2 right join views.v x3 on x2.a=x3.a ;;
-- FULL JOIN
select * from views.v x1 full join table(select x1.b a) x2 on x1.a=x2.a ;;
select * from views.v x1, table(select x1.a a) x2 full join views.v x3 on x2.a=x3.a ;;
select * from views.v x1 full join lateral(select x1.b a) x2 on x1.a=x2.a ;;
select * from views.v x1, lateral(select x1.a a) x2 full join views.v x3 on x2.a=x3.a ;;
select * from views.v x1 full join texttable(x1.a||'' columns a string) x2 on x1.a=x2.a ;;
select * from views.v x1, texttable(x1.a||'' columns a string) x2 full join views.v x3 on x2.a=x3.a ;;
select * from views.v x1 full join xmltable('/a' PASSING xmlparse(document '<a id="' || x1.a || '"/>') COLUMNS a integer PATH '@id') x2 on x1.a=x2.a ;;
select * from views.v x1, xmltable('/a' PASSING xmlparse(document '<a id="' || x1.a || '"/>') COLUMNS a integer PATH '@id') x2 full join views.v x3 on x2.a=x3.a ;;
{code}
> Joining more than one table/view to results of table function causes error, Table functions cause errors in queries containing RIGH or FULL JOINs
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: TEIID-5271
> URL: https://issues.jboss.org/browse/TEIID-5271
> Project: Teiid
> Issue Type: Bug
> Components: Query Engine
> Affects Versions: 10.1
> Environment: teiid-10.1.0 on WildFly Full 11.0.0.Final (WildFly Core 3.0.8.Final)
> Reporter: dalex dalex
> Assignee: Steven Hawkins
>
> Joining more than one table/view to results of table function causes error. For example, such query:
> {code:sql}
> select * from views.v x1, table(select x1.a a) x2 join views.v x3 on x2.a=x3.a join views.v x4 on x4.a=x3.a ;;
> {code}
> causes such error:
> {code:noformat}
> 2018-03-05 10:20:14,105 ERROR [org.teiid.PROCESSOR] (Worker3_QueryProcessorQueue10) /oCxMs2/Zs22 TEIID30019 Unexpected exception for request /oCxMs2/Zs22.5: org.teiid.core.TeiidCompo
> nentException: TEIID30328 Unable to evaluate x1.a: No value was available
> at org.teiid.query.util.CommandContext.getFromContext(CommandContext.java:520)
> at org.teiid.query.eval.Evaluator.internalEvaluate(Evaluator.java:751)
> at org.teiid.query.eval.Evaluator.evaluate(Evaluator.java:707)
> at org.teiid.query.eval.Evaluator.evaluate(Evaluator.java:344)
> at org.teiid.query.eval.Evaluator.internalEvaluateTVL(Evaluator.java:185)
> at org.teiid.query.eval.Evaluator.evaluate(Evaluator.java:297)
> at org.teiid.query.eval.Evaluator.internalEvaluateTVL(Evaluator.java:181)
> at org.teiid.query.eval.Evaluator.evaluateTVL(Evaluator.java:174)
> at org.teiid.query.eval.Evaluator.evaluate(Evaluator.java:168)
> at org.teiid.query.processor.relational.SelectNode.nextBatchDirect(SelectNode.java:106)
> at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
> at org.teiid.query.processor.relational.LimitNode.nextBatchDirect(LimitNode.java:98)
> at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
> at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:146)
> at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
> at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:141)
> at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:148)
> at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:111)
> at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:160)
> at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:142)
> at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:480)
> at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:350)
> at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:47)
> at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:276)
> at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:280)
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:115)
> at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:206)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> {code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the teiid-issues
mailing list