Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0
Description
The issue can be reproduced with the following query:
create table test1 (s string); create table test2 (m string); EXPLAIN CBO SELECT c.m FROM ( SELECT substr(from_unixtime(unix_timestamp(), 'yyyy-MM-dd'), 1, 1) as m FROM test1 WHERE substr(from_unixtime(unix_timestamp(), 'yyyy-MM-dd'), 1, 1) = '2') c JOIN test2 d ON c.m = d.m;
It fails with the following exception:
java.util.NoSuchElementException at java.util.HashMap$HashIterator.nextNode(HashMap.java:1447) at java.util.HashMap$KeyIterator.next(HashMap.java:1469) at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveFilterProjectTransposeRule$RedundancyChecker.check(HiveFilterProjectTransposeRule.java:348) at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveFilterProjectTransposeRule$RedundancyChecker.visit(HiveFilterProjectTransposeRule.java:306) at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveFilterProjectTransposeRule$RedundancyChecker.visit(HiveFilterProjectTransposeRule.java:303) at org.apache.calcite.rel.SingleRel.childrenAccept(SingleRel.java:72) at org.apache.calcite.rel.RelVisitor.visit(RelVisitor.java:44) at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveFilterProjectTransposeRule$RedundancyChecker.visit(HiveFilterProjectTransposeRule.java:316) at org.apache.calcite.rel.RelVisitor.go(RelVisitor.java:61) at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveFilterProjectTransposeRule.isRedundantIsNotNull(HiveFilterProjectTransposeRule.java:276) at org.apache.hadoop.hive.ql.optimizer.calcite.rules.HiveFilterProjectTransposeRule.onMatch(HiveFilterProjectTransposeRule.java:191)
The current implementation, while checking if the predicate to be transposed is redundant or not, it expects at least one InputRef, but the predicate can have none as in this case.
Attachments
Issue Links
- links to