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

Assertion failed error when joining duplicate rows to a table from other source

    Details

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

      teiid-8.12-Beta1 on Red Hat JBoss Enterprise Application Platform - Version 6.3.0.GA

    • Steps to Reproduce:
      Hide

      1. In postgresql create the test_a table by the following script:

      CREATE TABLE test_a
      (
        a integer,
        b integer
      );
       
      INSERT INTO test_a(a, b) VALUES (1, 1);
      INSERT INTO test_a(a, b) VALUES (1, 2);
      INSERT INTO test_a(a, b) VALUES (2, 1);
      INSERT INTO test_a(a, b) VALUES (2, 2);
      INSERT INTO test_a(a, b) VALUES (3, 2);
      INSERT INTO test_a(a, b) VALUES (3, 10);
      

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

      <datasource jndi-name="java:/test_pg" pool-name="test_pg" enabled="true" use-java-context="true">
                          <connection-url>jdbc:postgresql://localhost:5432/test?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>postgres</user-name>
                              <password>xxxxxx</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_pg configured in previous step as datasource:

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

      4. Run the query:

      select * from (select 3 as a, 3 as b union all
      	select 1 as a, 1 as b union all
      	select 3 as a, 3 as b) as t1 join test_pg.test_a t2 on t1.a=t2.a limit 10;
      

      which will fail with ASSERTION FAILED error message. But the following query won't fail:

      select * from (select 1 as a, 1 as b union all
      	select 3 as a, 3 as b) as t1 join test_pg.test_a t2 on t1.a=t2.a;
      

      Show
      1. In postgresql create the test_a table by the following script: CREATE TABLE test_a ( a integer , b integer );   INSERT INTO test_a(a, b) VALUES (1, 1); INSERT INTO test_a(a, b) VALUES (1, 2); INSERT INTO test_a(a, b) VALUES (2, 1); INSERT INTO test_a(a, b) VALUES (2, 2); INSERT INTO test_a(a, b) VALUES (3, 2); INSERT INTO test_a(a, b) VALUES (3, 10); 2. Add postgresql database configuration in standalone-teiid.xml < datasource jndi-name = "java:/test_pg" pool-name = "test_pg" enabled = "true" use-java-context = "true" > < connection -url>jdbc:postgresql://localhost:5432/test?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>postgres</ user -name> < password >xxxxxx</ 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_pg configured in previous step as datasource: < model name = "test_pg" > < property name = "importer.useFullSchemaName" value = "false" /> < property name = "importer.tableTypes" value = "TABLE,VIEW" /> < property name = "importer.importKeys" value = "false" /> < source name = "test_pg" translator-name = "myPg" connection-jndi-name = "java:/test_pg" /> </ model > 4. Run the query: select * from ( select 3 as a, 3 as b union all select 1 as a, 1 as b union all select 3 as a, 3 as b) as t1 join test_pg.test_a t2 on t1.a=t2.a limit 10; which will fail with ASSERTION FAILED error message. But the following query won't fail: select * from ( select 1 as a, 1 as b union all select 3 as a, 3 as b) as t1 join test_pg.test_a t2 on t1.a=t2.a;

      Description

      I get the following error when joining duplicate rows to a table from other source:

      17:20:52,718 ERROR [org.teiid.PROCESSOR] (Worker0_QueryProcessorQueue21) irzl30n7Sda0 TEIID30019 Unexpected exception for request irzl30n7Sda0.8: java.lang.AssertionError: ASSERTION
      FAILED: expected reference to be not null
              at org.teiid.core.util.Assertion.failed(Assertion.java:73) [teiid-common-core-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.core.util.Assertion.isNotNull(Assertion.java:100) [teiid-common-core-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.core.util.Assertion.isNotNull(Assertion.java:92) [teiid-common-core-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.common.buffer.TupleBuffer.getBatch(TupleBuffer.java:286) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.common.buffer.TupleBuffer$TupleBufferTupleSource.getBatch(TupleBuffer.java:74) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.common.buffer.AbstractTupleSource.getCurrentTuple(AbstractTupleSource.java:62) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.common.buffer.AbstractTupleSource.hasNext(AbstractTupleSource.java:92) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.MergeJoinStrategy.compareToPrevious(MergeJoinStrategy.java:279) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.MergeJoinStrategy.process(MergeJoinStrategy.java:237) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.EnhancedSortMergeJoinStrategy.process(EnhancedSortMergeJoinStrategy.java:416) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.JoinNode.nextBatchDirect(JoinNode.java:227) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:278) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.LimitNode.nextBatchDirect(LimitNode.java:102) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:278) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:148) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:278) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:462) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:344) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:271) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210) [teiid-engine-8.12.0.Beta1.jar:8.12.0.Beta1]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
      

        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: