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

Complex Inline View queries fail with IndexOutOfBoundsException

    Details

    • Steps to Reproduce:
      Hide

      1. Configure VDB model based on "billofmaterials" table from standard MySQL's AdventureWorks database

       <datasource jndi-name="java:/MysqlAdventures" pool-name="mysql-ds" enabled="true">
                          <connection-url>jdbc:mysql://localhost:3306/adventureworks?useUnicode=true&amp;useJDBCCompliantTimezoneShift=true&amp;serverTimezone=UTC</connection-url>
                          <driver>mysql-connector-java-8.0.11.jar</driver>
                          <security>
                              <user-name>name</user-name>
                              <password>password</password>
                          </security>
                      </datasource>
      
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <vdb name="Portfolio" version="1">
       
          <description>MySQL VDB</description>
        
          <property name="UseConnectorMetadata" value="true" />
       
      <model name="nw">
               <source name="test_tables" translator-name="mylobs" connection-jndi-name="java:/MysqlAdventures"/>
               <metadata type = "DDL"><![CDATA[
      		CREATE FOREIGN TABLE billofmaterials (
      AssemblyID integer, 
      BillOfMaterialsID integer PRIMARY KEY,
      ComponentID integer,
      BOMLevel integer,
      UnitMeasureCode varchar(3),
      ObsoleteDate timestamp,
      ModifiedDate timestamp);
               ]]>
               </metadata>
      </model>
          <translator name="mylobs" type="mysql5">
              <property name="CopyLobs" value="true" />
              <property name="SupportsNativeQueries" value="false"/>
          </translator>
      
      </vdb>

      Note: it is important that translator type should be the one that has "InlineViews" property enabled, ie "mysql5" but not "mysql"

      2. Execute query against the table and make sure no "limit" clause is added by UI tool

      select 
      	timestampdiff(SQL_TSI_HOUR, ObsoleteDate, storn) as diff,
      	case when UnitMeasureCode='platnosci' or UnitMeasureCode like '%PayU - szybkie%' then 'PAYU' else '' end as payu,
      	case when UnitMeasureCode in ('moneyorder','Przelew bankowy') then 'przelew' else '' end as przelew 
      from (select ObsoleteDate,UnitMeasureCode, MIN(ModifiedDate) as storn from nw.billofmaterials group by ObsoleteDate,UnitMeasureCode ) w
      

      3. Query fails with the stack trace
      13:07:59,281 ERROR [org.teiid.PROCESSOR] (Worker3_QueryProcessorQueue23) UUzsqpVDE4q1 TEIID30019 Unexpected exception for request UUzsqpVDE4q1.8: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
      at java.util.ArrayList.rangeCheck(ArrayList.java:653)
      at java.util.ArrayList.get(ArrayList.java:429)
      at org.teiid.query.processor.relational.ProjectNode.updateTuple(ProjectNode.java:188)
      at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:165)
      at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277)
      at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:141)
      at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:148)
      at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:111)
      at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:160)
      at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:142)
      at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:480)
      at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:350)
      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:277)
      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:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)

      Show
      1. Configure VDB model based on "billofmaterials" table from standard MySQL's AdventureWorks database <datasource jndi-name= "java:/MysqlAdventures" pool-name= "mysql-ds" enabled= "true" > <connection-url> jdbc:mysql://localhost:3306/adventureworks?useUnicode=true&amp;useJDBCCompliantTimezoneShift=true&amp;serverTimezone=UTC </connection-url> <driver> mysql-connector-java-8.0.11.jar </driver> <security> <user-name> name </user-name> <password> password </password> </security> </datasource> <?xml version= "1.0" encoding= "UTF-8" standalone= "yes" ?> <vdb name= "Portfolio" version= "1" > <description> MySQL VDB </description> <property name= "UseConnectorMetadata" value= "true" /> <model name= "nw" > <source name= "test_tables" translator-name= "mylobs" connection-jndi-name= "java:/MysqlAdventures" /> <metadata type = "DDL" > <![CDATA[ CREATE FOREIGN TABLE billofmaterials ( AssemblyID integer, BillOfMaterialsID integer PRIMARY KEY, ComponentID integer, BOMLevel integer, UnitMeasureCode varchar(3), ObsoleteDate timestamp, ModifiedDate timestamp); ]]> </metadata> </model> <translator name= "mylobs" type= "mysql5" > <property name= "CopyLobs" value= "true" /> <property name= "SupportsNativeQueries" value= "false" /> </translator> </vdb> Note: it is important that translator type should be the one that has "InlineViews" property enabled, ie "mysql5" but not "mysql" 2. Execute query against the table and make sure no "limit" clause is added by UI tool select timestampdiff(SQL_TSI_HOUR, ObsoleteDate, storn) as diff, case when UnitMeasureCode= 'platnosci' or UnitMeasureCode like '%PayU - szybkie%' then 'PAYU' else '' end as payu, case when UnitMeasureCode in ( 'moneyorder' , 'Przelew bankowy' ) then 'przelew' else '' end as przelew from ( select ObsoleteDate,UnitMeasureCode, MIN (ModifiedDate) as storn from nw.billofmaterials group by ObsoleteDate,UnitMeasureCode ) w 3. Query fails with the stack trace 13:07:59,281 ERROR [org.teiid.PROCESSOR] (Worker3_QueryProcessorQueue23) UUzsqpVDE4q1 TEIID30019 Unexpected exception for request UUzsqpVDE4q1.8: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.get(ArrayList.java:429) at org.teiid.query.processor.relational.ProjectNode.updateTuple(ProjectNode.java:188) at org.teiid.query.processor.relational.ProjectNode.nextBatchDirect(ProjectNode.java:165) at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:277) at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:141) at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:148) at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:111) at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:160) at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:142) at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:480) at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:350) 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:277) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

      Gliffy Diagrams

        Attachments

          Activity

            People

            • Assignee:
              shawkins Steven Hawkins
              Reporter:
              isemenov Ivan Semenov
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: