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

NPE in QueryResolver when calling virtual procedure

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 10.1, 10.0.2
    • None
    • Query Engine
    • None
    • 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.

      When running query:

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

      teiid is throwing out the following stacktrace:

      Unable to find source-code formatter for language: noformat. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      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)
      

              rhn-engineering-shawkins Steven Hawkins
              dalex005 Dmitrii Pogorelov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: