Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5271

Joining more than one table/view to results of table function causes error

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 10.1
    • Fix Version/s: 10.0.4, 10.2, 10.1.2
    • Component/s: Query Engine
    • Labels:
      None
    • Environment:

      teiid-10.1.0 on WildFly Full 11.0.0.Final (WildFly Core 3.0.8.Final)

    • Steps to Reproduce:
      Hide

      1. Configure in the test-vdb.xml the following virtual view and procedure:

          <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>
      

      2. Run the following queries for the first problem (TEIID30328 Unable to evaluate x1.a: No value was available):

      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 ;;
      

      Show
      1. Configure in the test-vdb.xml the following virtual view and procedure: < 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 > 2. Run the following queries for the first problem (TEIID30328 Unable to evaluate x1.a: No value was available): 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 ;;

      Description

      Joining more than one table/view to results of table function causes error. For example, such query:

      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 ;;
      

      causes such error:

      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)
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shawkins Steven Hawkins
                Reporter:
                dalex005 dalex dalex
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: