8 Replies Latest reply on Jul 8, 2016 10:32 AM by mtawk

    ASSERTION FAILED: expected reference to be not null

    mtawk

      I'm using teiid 9.0.0 over h2 :

       

      I'm getting ASSERTION_FAILED over the following query and can not find what is causing this exception:

       

      select "Sheet1"."AvgAmoutRange" as "Sheet1_EBt_211215_AvgAmoutRa1",COUNT( distinct IFNULL("CEGlobalView"."Customer_CustomerID",-2147483648)) as "CEGlobalView_Customer_Custom2","CEGlobalView"."Customer_GenderID" as "CEGlobalView_Customer_Gender1","Gender"."Gender" as "Gender_Gender","Sheet1"."Sheet1_EBt_211215ID" as "Sheet1_EBt_211215_Sheet1_EBt11" from  "CEBanksBusinessModel"."CEGlobalView" "CEGlobalView" LEFT JOIN "h2dbimplify_data_cebankModel_ST"."implify_data_cebank"."Sheet1_EBt_211215" "Sheet1" ON   ( ("CEGlobalView"."StreamCardsvt3r_StreamCards_1" BETWEEN  "Sheet1"."Min" and "Sheet1"."Max") )

      LEFT JOIN "h2dbimplify_data_cebankModel_fR"."implify_data_cebank"."Gender" "Gender" ON "CEGlobalView"."Customer_GenderID" = "Gender"."GenderID"

      LEFT JOIN "h2dbimplify_data_cebankModel_fR"."implify_data_cebank"."CustomerTag" "CustomerTag" ON "CEGlobalView"."Customer_CustomerID" = "CustomerTag"."Customer_CustomerID" AND ( ( ("CustomerTag"."EndDateTime" >  CURDATE()) OR ( ("CustomerTag"."EndDateTime" IS  null ) ) ) )

      LEFT JOIN "h2dbimplify_data_cebankModel_fR"."implify_data_cebank"."TagValue" "TagValue" ON "CustomerTag"."TagValue_TagValueID" = "TagValue"."TagValueID"

      LEFT JOIN "h2dbimplify_data_cebankModel_fR"."implify_data_cebank"."TagName" "TagName" ON "TagValue"."TagName_TagNameID" = "TagName"."TagNameID" AND ( ( ("TagName"."TagType_TagTypeID" IN  (1.0) ) ) AND ( ("TagName"."TagScope_TagScopeID" IN  (1.0) ) ) )

      where  ( ( ( ("TagName"."TagName" IN  ('Behavior') ) ) ) AND ( ("Sheet1"."AvgAmoutRange" IS NOT  null ) ) AND ( ("CEGlobalView"."Customer_GenderID" IS NOT  null ) ) AND ( ("Gender"."Gender" IS NOT  null ) ) )  group by "Sheet1"."AvgAmoutRange","CEGlobalView"."Customer_GenderID","Gender"."Gender","Sheet1"."Sheet1_EBt_211215ID" order by "Sheet1"."Sheet1_EBt_211215ID" ASC,"Sheet1"."AvgAmoutRange" ASC,"Gender"."Gender" DESC,"CEGlobalView"."Customer_GenderID" DESC

       

      Here is the corresponding execution plan:

       

      <?xml version='1.0' encoding='UTF-8'?><node name="ProjectNode"><property name="Relational Node ID"><value>1</value></property><property name="Output Columns"><value>StreamAccountNOSX_StreamAcco1 (integer)</value><value>StreamChannel_StreamChannel (string)</value><value>StreamAccountNOSX_StreamAcco (long)</value><value>StreamAccountNOSX_StreamAcco31 (integer)</value><value>StreamChannel_StreamChannel1 (string)</value><value>StreamAccountNOSX_StreamAcco2 (long)</value></property><property name="Statistics"><value>Node Output Rows: 0</value><value>Node Next Batch Process Time: 0</value><value>Node Cumulative Next Batch Process Time: 0</value><value>Node Cumulative Process Time: 0</value><value>Node Next Batch Calls: 0</value><value>Node Blocks: 0</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Child 0"><node name="GroupingNode"><property name="Relational Node ID"><value>2</value></property><property name="Output Columns"><value>gcol2 (integer)</value><value>gcol3 (string)</value><value>agg0 (long)</value></property><property name="Statistics"><value>Node Output Rows: 0</value><value>Node Next Batch Process Time: 0</value><value>Node Cumulative Next Batch Process Time: 0</value><value>Node Cumulative Process Time: 0</value><value>Node Next Batch Calls: 0</value><value>Node Blocks: 0</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Child 0"><node name="JoinNode"><property name="Relational Node ID"><value>3</value></property><property name="Output Columns"><value>StreamAccount_StreamChannelI (integer)</value><value>StreamChannel (string)</value><value>StreamAccount_StreamAcID (integer)</value></property><property name="Statistics"><value>Node Output Rows: 0</value><value>Node Next Batch Process Time: 0</value><value>Node Cumulative Next Batch Process Time: 0</value><value>Node Cumulative Process Time: 0</value><value>Node Next Batch Calls: 0</value><value>Node Blocks: 0</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Child 0"><node name="JoinNode"><property name="Relational Node ID"><value>4</value></property><property name="Output Columns"><value>TagValue_TagValueID (integer)</value><value>StreamAccount_StreamChannelI (integer)</value><value>StreamChannel (string)</value><value>StreamAccount_StreamAcID (integer)</value></property><property name="Statistics"><value>Node Output Rows: 0</value><value>Node Next Batch Process Time: 0</value><value>Node Cumulative Next Batch Process Time: 0</value><value>Node Cumulative Process Time: 0</value><value>Node Next Batch Calls: 0</value><value>Node Blocks: 0</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Child 0"><node name="JoinNode"><property name="Relational Node ID"><value>5</value></property><property name="Output Columns"/><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Child 0"><node name="AccessNode"><property name="Relational Node ID"><value>6</value></property><property name="Output Columns"><value>StreamAccount_StreamChannelI (integer)</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Query"><value>SELECT g_0.StreamAccount_StreamChannelI AS c_0 FROM h2dbimplify_data_cebankModel_ST.implify_data_cebank.StreamAccountNOSX AS g_0 LEFT OUTER JOIN h2dbimplify_data_cebankModel_ST.implify_data_cebank.CEGlobalView AS g_1 ON g_0.StreamAccount_CustomerID = g_1.Customer_CustomerID WHERE (g_0.StreamAccount_DateTime4 >= '2015-07') AND (g_0.StreamAccount_DateTime4 &lt;= '2016-07') ORDER BY c_0</value></property><property name="Model Name"><value>h2dbimplify_data_cebankModel_ST</value></property></node></property><property name="Child 1"><node name="AccessNode"><property name="Relational Node ID"><value>7</value></property><property name="Output Columns"><value>StreamChannelID (integer)</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Query"><value>SELECT g_0.StreamChannelID AS c_0 FROM h2dbimplify_data_cebankModel_fR.implify_data_cebank.StreamChannel AS g_0 ORDER BY c_0</value></property><property name="Model Name"><value>h2dbimplify_data_cebankModel_fR</value></property></node></property><property name="Join Strategy"><value>MERGE JOIN (ALREADY_SORTED/ALREADY_SORTED)</value></property><property name="Join Type"><value>LEFT OUTER JOIN</value></property><property name="Join Criteria"><value>StreamAccount_StreamChannelI=StreamChannel.StreamChannelID</value></property></node></property><property name="Child 1"><node name="AccessNode"><property name="Relational Node ID"><value>8</value></property><property name="Output Columns"><value>Customer_CustomerID (integer)</value><value>TagValue_TagValueID (integer)</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Query"><value>SELECT g_0.Customer_CustomerID, g_0.TagValue_TagValueID FROM h2dbimplify_data_cebankModel_fR.implify_data_cebank.CustomerTag AS g_0 WHERE (g_0.EndDateTime > convert(CURDATE(), timestamp)) OR (g_0.EndDateTime IS NULL)</value></property><property name="Model Name"><value>h2dbimplify_data_cebankModel_fR</value></property></node></property><property name="Join Strategy"><value>NESTED LOOP JOIN</value></property><property name="Join Type"><value>LEFT OUTER JOIN</value></property><property name="Join Criteria"><value>Customer_CustomerID = CustomerTag.Customer_CustomerID</value></property></node></property><property name="Child 1"><node name="AccessNode"><property name="Relational Node ID"><value>9</value></property><property name="Output Columns"><value>TagValueID (integer)</value></property><property name="Cost Estimates"><value>Estimated Node Cardinality: -1.0</value></property><property name="Query"><value>SELECT g_0.TagValueID AS c_0 FROM h2dbimplify_data_cebankModel_fR.implify_data_cebank.TagValue AS g_0, h2dbimplify_data_cebankModel_fR.implify_data_cebank.TagName AS g_1 WHERE (g_0.TagName_TagNameID = g_1.TagNameID) AND (g_1.TagName = 'Behavior') AND (g_1.TagType_TagTypeID = 1) AND (g_1.TagScope_TagScopeID = 1) ORDER BY c_0</value></property><property name="Model Name"><value>h2dbimplify_data_cebankModel_fR</value></property></node></property><property name="Join Strategy"><value>ENHANCED SORT JOIN (SORT/ALREADY_SORTED)</value></property><property name="Join Type"><value>INNER JOIN</value></property><property name="Join Criteria"><value>CustomerTag.TagValue_TagValueID=TagValue.TagValueID</value></property></node></property><property name="Grouping Columns"><value>StreamChannel.StreamChannel</value><value>StreamAccount_StreamChannelI</value></property><property name="Grouping Mapping"><value>anon_grp0.gcol0=StreamAccount_StreamChannelI</value><value>anon_grp0.gcol1=StreamChannel.StreamChannel</value><value>anon_grp0.gcol2=StreamAccount_StreamChannelI</value><value>anon_grp0.gcol3=StreamChannel.StreamChannel</value><value>anon_grp0.agg0=SUM(StreamAccount_StreamAcID)</value></property><property name="Sort Mode"><value>false</value></property></node></property><property name="Select Columns"><value>anon_grp0.gcol2 AS StreamAccountNOSX_StreamAcco1</value><value>anon_grp0.gcol3 AS StreamChannel_StreamChannel</value><value>anon_grp0.agg0 AS StreamAccountNOSX_StreamAcco</value><value>anon_grp0.gcol2 AS StreamAccountNOSX_StreamAcco31</value><value>anon_grp0.gcol3 AS StreamChannel_StreamChannel1</value><value>anon_grp0.agg0 AS StreamAccountNOSX_StreamAcco2</value></property><property name="Data Bytes Sent"><value>0</value></property><property name="Planning Time"><value>25</value></property></node>

       

       

      The exception stack:

       

      ERROR TEIID_DQP_LOGGER:90 (http-bio-8080-exec-14) -  - [TEIID30019 Unexpected exception for request rBDBCRYcUyyM.0]

      java.lang.AssertionError: ASSERTION FAILED: expected reference to be not null

        at org.teiid.core.util.Assertion.failed(Assertion.java:73)

        at org.teiid.core.util.Assertion.isNotNull(Assertion.java:100)

        at org.teiid.core.util.Assertion.isNotNull(Assertion.java:92)

        at org.teiid.query.processor.relational.RelationalNode.getProjectionIndexes(RelationalNode.java:367)

        at org.teiid.query.processor.relational.JoinNode.initialize(JoinNode.java:133)

        at org.teiid.query.processor.relational.RelationalPlan.connectExternal(RelationalPlan.java:96)

        at org.teiid.query.processor.relational.RelationalPlan.connectExternal(RelationalPlan.java:102)

        at org.teiid.query.processor.relational.RelationalPlan.connectExternal(RelationalPlan.java:102)

        at org.teiid.query.processor.relational.RelationalPlan.connectExternal(RelationalPlan.java:102)

        at org.teiid.query.processor.relational.RelationalPlan.initialize(RelationalPlan.java:91)

        at org.teiid.query.processor.QueryProcessor.init(QueryProcessor.java:226)

        at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:138)

        at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)

        at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)

        at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)

        at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:472)

        at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:348)

        at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)

        at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:274)

        at org.teiid.dqp.internal.process.DQPCore.executeRequest(DQPCore.java:313)

        at org.teiid.dqp.internal.process.DQPCore.executeRequest(DQPCore.java:245)

        at sun.reflect.GeneratedMethodAccessor423.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.teiid.transport.LocalServerConnection$1$1.call(LocalServerConnection.java:177)

        at java.util.concurrent.FutureTask.run(FutureTask.java:262)

        at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)

        at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:260)

        at org.teiid.transport.LocalServerConnection$1.invoke(LocalServerConnection.java:175)

        at com.sun.proxy.$Proxy34.executeRequest(Unknown Source)

        at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:673)

        at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:539)

        at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:1060)

        at org.teiid.jdbc.StatementImpl.execute(StatementImpl.java:323)

        • 1. Re: ASSERTION FAILED: expected reference to be not null
          shawkins

          This is indicating an error during planning, such that at execution time we can't find the necessary column for sorting.  Would it be possible to attach the full plan debug log?  That would make it clear at which point in planning something is going wrong.

          • 2. Re: ASSERTION FAILED: expected reference to be not null
            mtawk

            2016-07-07 08:38:44,562 DEBUG TEIID_QUERY_PLANNER_LOGGER:99 - [[LOW [Materialized View] The query against CEBanksBusinessModel.StreamAccountNOSX AS StreamAccountNOSX was redirected to the materialization table h2dbimplify_data_cebankModel_ST.implify_data_cebank.StreamAccountNOSX. - null, LOW [Materialized View] The query against CEBanksBusinessModel.CEGlobalView AS CEGlobalView was redirected to the materialization table h2dbimplify_data_cebankModel_ST.implify_data_cebank.CEGlobalView. - null, LOW [Relational Planner] parent join has no equa-join predicates - Rejecting dependent join Join(groups=[], props={JOIN_TYPE=LEFT OUTER JOIN, JOIN_STRATEGY=MERGE, JOIN_CRITERIA=[StreamAccount_StreamChannelI = StreamChannel.StreamChannelID], LEFT_EXPRESSIONS=[StreamAccount_StreamChannelI], RIGHT_EXPRESSIONS=[StreamChannel.StreamChannelID], NON_EQUI_JOIN_CRITERIA=[]}, LOW [Relational Planner] parent join has no equa-join predicates - Rejecting dependent join Access(groups=[h2dbimplify_data_cebankModel_fR.implify_data_cebank.CustomerTag AS CustomerTag], props={SOURCE_HINT=null, MODEL_ID=Schema name=h2dbimplify_data_cebankModel_fR, nameInSource=null, uuid=tid:c8889da6ab68-23ce22ca-00000000, OUTPUT_COLS=null, EST_CARDINALITY=-1.0}, LOW [Relational Planner] parent join has no equa-join predicates - Rejecting dependent join Join(groups=[], props={JOIN_TYPE=LEFT OUTER JOIN, JOIN_STRATEGY=MERGE, JOIN_CRITERIA=[StreamAccount_StreamChannelI = StreamChannel.StreamChannelID], LEFT_EXPRESSIONS=[StreamAccount_StreamChannelI], RIGHT_EXPRESSIONS=[StreamChannel.StreamChannelID], NON_EQUI_JOIN_CRITERIA=[]}, LOW [Relational Planner] parent join has no equa-join predicates - Rejecting dependent join Access(groups=[h2dbimplify_data_cebankModel_fR.implify_data_cebank.CustomerTag AS CustomerTag], props={SOURCE_HINT=null, MODEL_ID=Schema name=h2dbimplify_data_cebankModel_fR, nameInSource=null, uuid=tid:c8889da6ab68-23ce22ca-00000000, OUTPUT_COLS=null, EST_CARDINALITY=-1.0}]]

            • 3. Re: ASSERTION FAILED: expected reference to be not null
              shawkins

              I mean the log produced from setting "show plan debug" - SET Statement · Teiid Documentation

              • 4. Re: ASSERTION FAILED: expected reference to be not null
                mtawk

                you find attached the show plan debug

                • 5. Re: ASSERTION FAILED: expected reference to be not null
                  shawkins

                  This definitely highlights a planning issue.  There are no output columns assigned to one of the joins, which then causes the columns to not be found in the node above.  Can you log an issue for this?  If possible can you provide the vdb?

                  • 6. Re: ASSERTION FAILED: expected reference to be not null
                    mtawk

                    I'll add an issue for this.

                    Concerning the vdb, we are using an teiid embedded, is there a way to put the vdb into an xml to send it to you?

                    • 7. Re: ASSERTION FAILED: expected reference to be not null
                      shawkins

                      Actually I don't think it will be necessary.  I can reproduce this without it.