2 Replies Latest reply on Mar 27, 2018 4:52 PM by Mike Higgins

    ClassCastException during query optimization

    Mike Higgins Newbie

      Using Teiid 10.1 against an Oracle database, if I submit a query with exactly two bind variables such as the following:

       

      SELECT "Small Molecules"."MOLREGNO", "Small Molecules"."CHEMBL_ID",

          "Small Molecules_2"."FULL_MWT", CHEMBL_20.ACTIVITIES."ACTIVITY_ID",

          CHEMBL_20.ACTIVITIES."ACTIVITY_ID", ((CHEMBL_20.ACTIVITIES."ASSAY_ID" ||

          '#') || CHEMBL_20.ACTIVITIES."STANDARD_TYPE") "ID_RESULT",

          CHEMBL_20.ACTIVITIES."STANDARD_UNITS",

          CHEMBL_20.ACTIVITIES."ACTIVITY_COMMENT",

          CHEMBL_20.ACTIVITIES."STANDARD_VALUE"

        FROM (SELECT CHEMBL_20.COMPOUND_STRUCTURES."MOLREGNO",

          SM_DICTIONARY_PRIME."CHEMBL_ID" FROM chembl_20.compound_structures INNER

          JOIN chembl_20.molecule_dictionary SM_DICTIONARY_PRIME ON (

          CHEMBL_20.COMPOUND_STRUCTURES."MOLREGNO" = SM_DICTIONARY_PRIME."MOLREGNO")

          UNION ALL SELECT CHEMBL_20.SM_REPOSITORY."MOLREGNO",

          CHEMBL_20.SM_REPOSITORY."CHEMBL_ID" FROM chembl_20.sm_repository)

          "Small Molecules" LEFT OUTER JOIN chembl_20.compound_properties

          "Small Molecules_2" ON ("Small Molecules"."MOLREGNO" =

          "Small Molecules_2"."MOLREGNO") INNER JOIN chembl_20.activities ON ((

          "Small Molecules"."MOLREGNO" = CHEMBL_20.ACTIVITIES."MOLREGNO") AND ((

          CHEMBL_20.ACTIVITIES."STANDARD_TYPE" = 'IC50') AND (

          CHEMBL_20.ACTIVITIES."ASSAY_ID" IN ('654926', '654933'))))

        WHERE ("Small Molecules"."MOLREGNO" IN (?, ?)

       

      I get the following traceback, indicating that a class that does not implement Comparable is being stored in a TreeMap:

            [exec] 23 Mar 2018 15:04:28,282    [Worker67_QueryProcessorQueue3267]      ERROR   PROCESSOR-      TEIID30019 Unexpected exception for request RkVKlFhEnEgf.0: java.lang.ClassCastException: org.teiid.query.sql.symbol.Reference cannot be cast to java.lang.Comparable

           [exec]     at java.util.TreeMap.getEntry(TreeMap.java:349)

           [exec]     at java.util.TreeMap.containsKey(TreeMap.java:232)

           [exec]     at java.util.TreeSet.contains(TreeSet.java:234)

           [exec]     at java.util.AbstractCollection.containsAll(AbstractCollection.java:318)

           [exec]     at org.teiid.query.sql.lang.SetCriteria.equals(SetCriteria.java:136)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.copyCriteria(RuleCopyCriteria.java:169)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.createCriteria(RuleCopyCriteria.java:341)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.tryToCopy(RuleCopyCriteria.java:268)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.visitChildern(RuleCopyCriteria.java:384)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.tryToCopy(RuleCopyCriteria.java:294)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.visitChildern(RuleCopyCriteria.java:384)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.tryToCopy(RuleCopyCriteria.java:294)

           [exec]     at org.teiid.query.optimizer.relational.rules.RuleCopyCriteria.execute(RuleCopyCriteria.java:99)

           [exec]     at org.teiid.query.optimizer.relational.RelationalPlanner.executeRules(RelationalPlanner.java:995)

           [exec]     at org.teiid.query.optimizer.relational.RelationalPlanner.optimize(RelationalPlanner.java:228)

           [exec]     at org.teiid.query.optimizer.QueryOptimizer.optimizePlan(QueryOptimizer.java:179)

           [exec]     at org.teiid.dqp.internal.process.Request.generatePlan(Request.java:458)

           [exec]     at org.teiid.dqp.internal.process.PreparedStatementRequest.generatePlan(PreparedStatementRequest.java:124)

           [exec]     at org.teiid.dqp.internal.process.Request.processRequest(Request.java:486)

           [exec]     at org.teiid.dqp.internal.process.PreparedStatementRequest.processRequest(PreparedStatementRequest.java:345)

           [exec]     at org.teiid.dqp.internal.process.RequestWorkItem.processNew(RequestWorkItem.java:660)

           [exec]     at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:339)

           [exec]     at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:47)

           [exec]     at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:276)

           [exec]     at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:280)

           [exec]     at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:115)

           [exec]     at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:206)

           [exec]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

           [exec]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

           [exec]     at java.lang.Thread.run(Thread.java:745)

           [exec]

       

      Should I file a bug?