Mustafa İman created HIVE-24638:
-----------------------------------
Summary: Redundant filter in scalar subquery
Key: HIVE-24638
URL: https://issues.apache.org/jira/browse/HIVE-24638
Project: Hive
Issue Type: Improvement
Reporter: Mustafa İman
Look at the query and CBO plan in
https://issues.apache.org/jira/browse/HIVE-24595 .
Note that there is a filter to guarantee that subquery returns only one row:
"HiveFilter(condition=[<=(sq_count_check($0), 1)])" . This condition is
redundant as either sq_count_check fails in runtime or condition is true for
all rows.
Look at the stacktrace
{code:java}
at
org.apache.hadoop.hive.ql.udf.generic.GenericUDFSQCountCheck.evaluate(GenericUDFSQCountCheck.java:70)
at
org.apache.hadoop.hive.ql.udf.generic.GenericUDFSQCountCheck.evaluate(GenericUDFSQCountCheck.java:70)
at
org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator._evaluate(ExprNodeGenericFuncEvaluator.java:197)
at
org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator.evaluate(ExprNodeEvaluator.java:80)
at
org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator$DeferredExprObject.get(ExprNodeGenericFuncEvaluator.java:88)
at
org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPEqualOrLessThan.evaluate(GenericUDFOPEqualOrLessThan.java:111)
at
org.apache.hadoop.hive.ql.exec.ExprNodeGenericFuncEvaluator._evaluate(ExprNodeGenericFuncEvaluator.java:197)
at
org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator.evaluate(ExprNodeEvaluator.java:80)
at
org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator.evaluate(ExprNodeEvaluator.java:68)
at
org.apache.hadoop.hive.ql.exec.FilterOperator.process(FilterOperator.java:113)
at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888) at
org.apache.hadoop.hive.ql.exec.GroupByOperator.forward(GroupByOperator.java:1004)
at
org.apache.hadoop.hive.ql.exec.GroupByOperator.flush(GroupByOperator.java:1028)
{code}
GenericUDFOPEqualOrLessThan is redundant here as GenericUDFSQCountCheck does
the same check.
Instead of this filter we can have HiveProject(sq_count_check($0))
--
This message was sent by Atlassian Jira
(v8.3.4#803005)