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

NPE in QueryResolver when calling virtual procedure

    XMLWordPrintable

    Details

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

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

    • Steps to Reproduce:
      Hide

      1. create the following view and proc:

          <model visible = "true" type = "VIRTUAL" name = "views">
              <metadata type = "DDL"><![CDATA[
                create view v as select 1 as a1 
              ]]>
              </metadata>
          </model>
       
          <model visible = "true" type = "VIRTUAL" name = "procs">
              <metadata type = "DDL"><![CDATA[
                create virtual procedure pr0() returns (res integer) as
                begin
                  select a.a1 from (SELECT * FROM views.v p) a where a.a1 in (select a1 from a);
                end       
              ]]>
              </metadata>
          </model>
      

      2. run the query:

      select * from (call procs.pr0()) a
      

      but changing pr0 procedure on (changing sub-query in "in" clause):

          <model visible = "true" type = "VIRTUAL" name = "procs">
              <metadata type = "DDL"><![CDATA[
                create virtual procedure pr0() returns (res integer) as
                begin
                  select a.a1 from (SELECT * FROM views.v p) a where a.a1 in (1);
                end       
              ]]>
              </metadata>
          </model>
      

      solves the NPE.

      Show
      1. create the following view and proc: < model visible = "true" type = "VIRTUAL" name = "views" > < metadata type = "DDL" > <![CDATA[ create view v as select 1 as a1 ]]> </ metadata > </ model >   < model visible = "true" type = "VIRTUAL" name = "procs" > < metadata type = "DDL" > <![CDATA[ create virtual procedure pr0() returns (res integer) as begin select a.a1 from (SELECT * FROM views.v p) a where a.a1 in (select a1 from a); end ]]> </ metadata > </ model > 2. run the query: select * from (call procs.pr0()) a but changing pr0 procedure on (changing sub-query in "in" clause): < model visible = "true" type = "VIRTUAL" name = "procs" > < metadata type = "DDL" > <![CDATA[ create virtual procedure pr0() returns (res integer) as begin select a.a1 from (SELECT * FROM views.v p) a where a.a1 in (1); end ]]> </ metadata > </ model > solves the NPE.

      Description

      When running query:

      select * from (call procs.pr0()) a
      

      teiid is throwing out the following stacktrace:

      2017-12-20 14:28:12,939 ERROR [org.teiid.PROCESSOR] (Worker2_QueryProcessorQueue6) hVe+gXzCsZCA TEIID30019 Unexpected exception for request hVe+gXzCsZCA.1: java.lang.NullPointerExcep
      tion
              at org.teiid.query.resolver.QueryResolver.resolveView(QueryResolver.java:387)
              at org.teiid.query.optimizer.relational.RelationalPlanner.resolveVirtualGroup(RelationalPlanner.java:2080)
              at org.teiid.query.optimizer.relational.RelationalPlanner.buildTree(RelationalPlanner.java:1462)
              at org.teiid.query.optimizer.relational.RelationalPlanner.createQueryPlan(RelationalPlanner.java:1349)
              at org.teiid.query.optimizer.relational.RelationalPlanner.createQueryPlan(RelationalPlanner.java:1300)
              at org.teiid.query.optimizer.relational.RelationalPlanner.generatePlan(RelationalPlanner.java:1027)
              at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:203)
              at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:179)
              at org.teiid.query.optimizer.relational.RelationalPlanner.planSubqueries(RelationalPlanner.java:737)
              at org.teiid.query.optimizer.relational.RelationalPlanner.connectSubqueryContainers(RelationalPlanner.java:696)
              at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:220)
              at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:179)
              at org.teiid.query.optimizer.ProcedurePlanner.optimize(ProcedurePlanner.java:86)
              at org.teiid.query.optimizer.QueryOptimizer.planProcedure(QueryOptimizer.java:206)
              at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:146)
              at org.teiid.query.optimizer.relational.RelationalPlanner.addNestedCommand(RelationalPlanner.java:1719)
              at org.teiid.query.optimizer.relational.RelationalPlanner.addNestedProcedure(RelationalPlanner.java:1181)
              at org.teiid.query.optimizer.relational.RelationalPlanner.createStoredProcedurePlan(RelationalPlanner.java:1271)
              at org.teiid.query.optimizer.relational.RelationalPlanner.generatePlan(RelationalPlanner.java:1037)
              at org.teiid.query.optimizer.relational.RelationalPlanner.addNestedCommand(RelationalPlanner.java:1709)
              at org.teiid.query.optimizer.relational.RelationalPlanner.buildTree(RelationalPlanner.java:1532)
              at org.teiid.query.optimizer.relational.RelationalPlanner.createQueryPlan(RelationalPlanner.java:1349)
              at org.teiid.query.optimizer.relational.RelationalPlanner.createQueryPlan(RelationalPlanner.java:1300)
              at org.teiid.query.optimizer.relational.RelationalPlanner.generatePlan(RelationalPlanner.java:1027)
              at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:203)
              at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:179)
              at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:458)
              at org.teiid.dqp.internal.process.Request.processRequest(Request.java:486)
              at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:660)
              at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:339)
              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: