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

NPE on running an "execute immediate" command defined in a virtual procedure (Teiid-8.9.0-CR2)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.9
    • 8.7
    • Query Engine
    • None

      I defined a virtual procedure in the VDB using the following definition:

      <model visible = "true" type = "VIRTUAL" name = "test_procs">  
           <metadata type = "DDL"><![CDATA[  
                create virtual procedure p1(a long) returns (res long) as   
                begin  
                     execute immediate 'insert into pg.xyz select ''a''';  
                end;                                 
               ]]>  
           </metadata>  
      </model>  
      

      When I call the virtual procedure:

      exec test_procs.p1(1);

      I get the following NPE:

      12:56:59,868 ERROR [org.teiid.PROCESSOR] (Worker4_QueryProcessorQueue37) sAgKanG+4e4X TEIID30019 Unexpected exception for request sAgKanG+4e4X.0: java.lang.NullPointerException  
              at org.teiid.query.optimizer.relational.rules.RuleAssignOutputElements.filterVirtualElements(RuleAssignOutputElements.java:477) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.optimizer.relational.rules.RuleAssignOutputElements.assignOutputElements(RuleAssignOutputElements.java:238) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.optimizer.relational.rules.RuleAssignOutputElements.assignOutputElements(RuleAssignOutputElements.java:292) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.optimizer.relational.rules.RuleAssignOutputElements.execute(RuleAssignOutputElements.java:117) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:739) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:221) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:159) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.proc.ExecDynamicSqlInstruction.process(ExecDynamicSqlInstruction.java:186) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.proc.ProcedurePlan.processProcedure(ProcedurePlan.java:379) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.proc.ProcedurePlan.nextBatchDirect(ProcedurePlan.java:288) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.proc.ProcedurePlan.nextBatch(ProcedurePlan.java:262) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.relational.PlanExecutionNode.nextBatchDirect(PlanExecutionNode.java:118) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:278) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:146) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:278) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:136) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:449) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:331) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:259) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:274) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210) [teiid-engine-8.9.0.CR2.jar:8.9.0.CR2]  
              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]  
      

      As a workaround, if I use the clause "WITHOUT RETURN" in the execute immediate command, the procedure is correctly executed:

       
      <model visible = "true" type = "VIRTUAL" name = "test_procs">  
           <metadata type = "DDL"><![CDATA[  
                create virtual procedure p1(a long) returns (res long) as   
                begin  
                     execute immediate 'insert into pg.xyz select ''a''' WITHOUT RETURN;  
                end;                                 
               ]]>  
           </metadata>  
      </model>
      

              rhn-engineering-shawkins Steven Hawkins
              redfox999 Salvatore R. (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: