You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Alessandro Solimando (Jira)" <ji...@apache.org> on 2021/11/29 16:18:00 UTC

[jira] [Closed] (CALCITE-4416) NullPointerException with merge join

     [ https://issues.apache.org/jira/browse/CALCITE-4416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alessandro Solimando closed CALCITE-4416.
-----------------------------------------
    Resolution: Fixed

Fixed by https://issues.apache.org/jira/browse/CALCITE-4199

> NullPointerException with merge join
> ------------------------------------
>
>                 Key: CALCITE-4416
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4416
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.26.0
>            Reporter: Alexander Staubo
>            Priority: Major
>
> Using the sqlline tool with the Elasticsearch adapter:
> {code:java}
> Error: Error while executing SQL "select a._MAP from "testindex" a left outer join "testindex" b on b._MAP['_id'] = a._MAP['department._ref'] where a._MAP['_id'] = '0000000A15'": null (state=,code=0)
> java.sql.SQLException: Error while executing SQL "select a._MAP from "testindex" a left outer join "testindex" b on b._MAP['_id'] = a._MAP['department._ref'] where a._MAP['_id'] = '0000000A15'": null
>  at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
>  at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
>  at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
>  at org.apache.calcite.avatica.AvaticaStatement.execute(AvaticaStatement.java:217)
>  at sqlline.Commands.executeSingleQuery(Commands.java:1054)
>  at sqlline.Commands.execute(Commands.java:1003)
>  at sqlline.Commands.sql(Commands.java:967)
>  at sqlline.SqlLine.dispatch(SqlLine.java:734)
>  at sqlline.SqlLine.begin(SqlLine.java:541)
>  at sqlline.SqlLine.start(SqlLine.java:267)
>  at sqlline.SqlLine.main(SqlLine.java:206)
> Caused by: java.lang.NullPointerException
>  at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:878)
>  at com.google.common.collect.ImmutableList$Builder.addAll(ImmutableList.java:823)
>  at org.apache.calcite.rel.metadata.RelMdCollation.mergeJoin(RelMdCollation.java:466)
>  at org.apache.calcite.rel.metadata.RelMdCollation.collations(RelMdCollation.java:157)
>  at GeneratedMetadataHandler_Collation.collations_$(Unknown Source)
>  at GeneratedMetadataHandler_Collation.collations(Unknown Source)
>  at GeneratedMetadataHandler_Collation.collations_$(Unknown Source)
>  at GeneratedMetadataHandler_Collation.collations(Unknown Source)
>  at org.apache.calcite.rel.metadata.RelMetadataQuery.collations(RelMetadataQuery.java:543)
>  at org.apache.calcite.rel.metadata.RelMdCollation.project(RelMdCollation.java:277)
>  at org.apache.calcite.rel.metadata.RelMdCollation.calc(RelMdCollation.java:270)
>  at org.apache.calcite.adapter.enumerable.EnumerableCalc.lambda$create$0(EnumerableCalc.java:99)
>  at org.apache.calcite.plan.RelTraitSet.replaceIfs(RelTraitSet.java:242)
>  at org.apache.calcite.adapter.enumerable.EnumerableCalc.create(EnumerableCalc.java:98)
>  at org.apache.calcite.adapter.enumerable.EnumerableProjectToCalcRule.onMatch(EnumerableProjectToCalcRule.java:50)
>  at org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:333)
>  at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:542)
>  at org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:407)
>  at org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:243)
>  at org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127)
>  at org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:202)
>  at org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:189)
>  at org.apache.calcite.tools.Programs.lambda$of$0(Programs.java:173)
>  at org.apache.calcite.tools.Programs$SequenceProgram.run(Programs.java:331)
>  at org.apache.calcite.prepare.Prepare.optimize(Prepare.java:166)
>  at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:297)
>  at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:208)
>  at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:642)
>  at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:508)
>  at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:478)
>  at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
>  at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:556)
>  at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
>  at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
>  ... 8 more
> {code}
> (Looks like this happens during the planning phase, since it also happens with "explain plan for".)
> After some debugging, it seems this is because my Elasticsearch mapping excludes certain attributes from _source by default, including "department". So the field is searchable, but comes back as null. The query will never work; but it should perhaps not throw an NPE.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)