[
https://issues.apache.org/jira/browse/HIVE-25749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alessandro Solimando updated HIVE-25749:
----------------------------------------
Description:
Accoring to "RelMetadataQuery.collations()"
[javadoc|https://github.com/apache/calcite/blob/calcite-1.25.0/core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java#L537],
the method can return "null" if collactions information are not available.
Hive invokes the method in two places
([RelFieldTrimmer|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/RelFieldTrimmer.java#L192]
and
[HiveJoin|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveJoin.java#L206]),
but it does not check for "null" return values, which can cause NPE.
For RelFieldTrimmer, the same bug has been fixed in Calcite (where the code has
been taken from) here:
https://github.com/apache/calcite/commit/47871235177a3a0d398b1d890d1d2e947028e052
was:
Accoring to "RelMetadataQuery.collations()"
[javadoc|https://github.com/apache/calcite/blob/calcite-1.25.0/core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java#L537],
the method can return "null" if collactions information are not available.
Hive invokes the method in two places
([RelFieldTrimmer|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/RelFieldTrimmer.java#L192]
and
[HiveJoin|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveJoin.java#L206]),
but it does not check for "null" return values, which can cause NPE.
> Check if RelMetadataQuery.collations() return null to avoid NPE
> ---------------------------------------------------------------
>
> Key: HIVE-25749
> URL: https://issues.apache.org/jira/browse/HIVE-25749
> Project: Hive
> Issue Type: Bug
> Components: CBO, Query Planning
> Affects Versions: 4.0.0
> Reporter: Alessandro Solimando
> Assignee: Alessandro Solimando
> Priority: Major
>
> Accoring to "RelMetadataQuery.collations()"
> [javadoc|https://github.com/apache/calcite/blob/calcite-1.25.0/core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java#L537],
> the method can return "null" if collactions information are not available.
> Hive invokes the method in two places
> ([RelFieldTrimmer|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/RelFieldTrimmer.java#L192]
> and
> [HiveJoin|https://github.com/apache/hive/blob/1046f41ea36ab3c8b036481128ba9b76dda2882a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/reloperators/HiveJoin.java#L206]),
> but it does not check for "null" return values, which can cause NPE.
> For RelFieldTrimmer, the same bug has been fixed in Calcite (where the code
> has been taken from) here:
> https://github.com/apache/calcite/commit/47871235177a3a0d398b1d890d1d2e947028e052
--
This message was sent by Atlassian Jira
(v8.20.1#820001)