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

NPE in RuleRaiseNull rule when using "insert into" command

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 14.0, 13.1.1
    • 13.1
    • Query Engine
    • None
    • DV Sprint 62
    • 0.5
    • Hide

      1. In postgresql create the test_mat_simplified table using the following script:

      CREATE TABLE public.test_mat_simplified
      (
        a integer,
        b integer
      );
      

      2. Add postgresql database configuration in standalone-teiid.xml:

                      <datasource jndi-name="java:/test_dwh_pg" pool-name="test_dwh_pg" enabled="true" use-java-context="true">
                          <connection-url>jdbc:postgresql://localhost:5432/test_dwh?charSet=utf8</connection-url>
                          <driver-class>org.postgresql.Driver</driver-class>
                          <driver>org.postgresql</driver>
                          <pool>
                              <min-pool-size>2</min-pool-size>
                              <max-pool-size>70</max-pool-size>
                              <prefill>false</prefill>
                              <use-strict-min>false</use-strict-min>
                              <flush-strategy>FailingConnectionOnly</flush-strategy>
                          </pool>
                          <security>
                              <user-name>XXXXX</user-name>
                              <password>XXXXX</password>
                          </security>
                          <validation>
                              <check-valid-connection-sql>select 0</check-valid-connection-sql>
                          </validation>
                          <timeout>
                              <blocking-timeout-millis>120000</blocking-timeout-millis>
                              <idle-timeout-minutes>5</idle-timeout-minutes>
                          </timeout>
                      </datasource>
      

      3. Add in test-vdb.xml java:/test_tables_pg configured in previous step as datasource:

          <model name="test_dwh_pg">
              <property name="importer.useFullSchemaName" value="false"/>
              <property name="importer.tableTypes" value="TABLE,VIEW"/>
              <property name="importer.importKeys" value="false"/>
              <source name="test_dwh_pg" translator-name="myPg" connection-jndi-name="java:/test_dwh_pg"/>
          </model>
      

      4. Configure in the test-vdb.xml the following virtual views:

          <model visible = "true" type = "VIRTUAL" name = "views">
              <metadata type = "DDL"><![CDATA[
              CREATE view v1 as
                select null as a
                union all
                select 1 as a;
              CREATE view mat_test_view_simplified as
                select a as a, a as b from views.v1 where a = null
                union all 
                select a as a, a as b from views.v1
              ]]>
              </metadata>
          </model>
      

      5. Run the following command:

      insert into test_dwh_pg.test_mat_simplified select * from views.mat_test_view_simplified ;;
      
      Show
      1. In postgresql create the test_mat_simplified table using the following script: CREATE TABLE public .test_mat_simplified ( a integer , b integer ); 2. Add postgresql database configuration in standalone-teiid.xml: <datasource jndi-name= "java:/test_dwh_pg" pool-name= "test_dwh_pg" enabled= "true" use-java-context= "true" > <connection-url> jdbc:postgresql://localhost:5432/test_dwh?charSet=utf8 </connection-url> <driver-class> org.postgresql.Driver </driver-class> <driver> org.postgresql </driver> <pool> <min-pool-size> 2 </min-pool-size> <max-pool-size> 70 </max-pool-size> <prefill> false </prefill> <use-strict-min> false </use-strict-min> <flush-strategy> FailingConnectionOnly </flush-strategy> </pool> <security> <user-name> XXXXX </user-name> <password> XXXXX </password> </security> <validation> <check-valid-connection-sql> select 0 </check-valid-connection-sql> </validation> <timeout> <blocking-timeout-millis> 120000 </blocking-timeout-millis> <idle-timeout-minutes> 5 </idle-timeout-minutes> </timeout> </datasource> 3. Add in test-vdb.xml java:/test_tables_pg configured in previous step as datasource: <model name= "test_dwh_pg" > <property name= "importer.useFullSchemaName" value= "false" /> <property name= "importer.tableTypes" value= "TABLE,VIEW" /> <property name= "importer.importKeys" value= "false" /> <source name= "test_dwh_pg" translator-name= "myPg" connection-jndi-name= "java:/test_dwh_pg" /> </model> 4. Configure in the test-vdb.xml the following virtual views: <model visible = "true" type = "VIRTUAL" name = "views" > <metadata type = "DDL" > <![CDATA[ CREATE view v1 as select null as a union all select 1 as a; CREATE view mat_test_view_simplified as select a as a, a as b from views.v1 where a = null union all select a as a, a as b from views.v1 ]]> </metadata> </model> 5. Run the following command: insert into test_dwh_pg.test_mat_simplified select * from views.mat_test_view_simplified ;;

      An NPE occurs when running the following query:

      insert into test_dwh_pg.test_mat_simplified select * from views.mat_test_view_simplified ;;
      

      stacktrace:

      2020-04-07 12:07:58,375 ERROR [org.teiid.PROCESSOR] (Worker0_QueryProcessorQueue26) tqwiPNv56nHR TEIID30019 Unexpected exception for request tqwiPNv56nHR.10: java.lang.NullPointerException                                                                                                                                                                                        at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.raiseNullNode(RuleRaiseNull.java:174)                                                                                     at org.teiid.query.optimizer.relational.rules.RuleRaiseNull.execute(RuleRaiseNull.java:66)                                                                                            at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:1101)                                                                                   at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:235)                                                                                        at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:181)                                                                                                     at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:483)                                                                                                              at org.teiid.dqp.internal.process.Request.processRequest(Request.java:511)                                                                                                            at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:671)                                                                                                at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:350)                                                                                                   at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:43)                                                                                                      at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:284)                                                                                                       at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:281)                                                                                                at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:124)                                                                               at org.teiid.dqp.internal.process.ThreadReuseExecutor$2.run(ThreadReuseExecutor.java:212)                                                                                             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:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 4 hours
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified