asolimando commented on a change in pull request #2839:
URL: https://github.com/apache/hive/pull/2839#discussion_r762066925
##########
File path:
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterProjectTransposeRule.java
##########
@@ -339,6 +339,11 @@ private void check(Filter filter) {
final RexNode filterCondition = simplify.simplify(filter.getCondition());
final Set<Integer> inputRefs =
HiveCalciteUtil.getInputRefs(newCondition);
+ // if the new IS NOT NULL has no input ref, there is redundancy here,
bail out
+ if (inputRefs.isEmpty()) {
+ return;
Review comment:
As discussed offline, `HiveReduceExpressionsRule` is applied already but
it cannot simplify those cases, for instance:
```
[ReduceExpressionsRule(Filter)] to
[rel#75:HiveFilter.HIVE.[].any(input=HepRelVertex#21,condition=AND(IS NOT
NULL($0), IS NOT NULL(CAST(TRUNC($0, _UTF-16LE'MONTH':VARCHAR(2147483647)
CHARACTER SET "UTF-16LE")):DATE), IS NOT NULL(CAST(TRUNC(CAST(TRUNC($0,
_UTF-16LE'MONTH':VARCHAR(2147483647) CHARACTER SET "UTF-16LE")):DATE,
_UTF-16LE'MONTH':VARCHAR(2147483647) CHARACTER SET "UTF-16LE")):DATE)))]
```
does not get simplified and the expression keeps growing.
[HIVE-25758](https://issues.apache.org/jira/browse/HIVE-25758)) is affected
by the same issue, but since the expression has no input ref in it, this fix
does not help. Once we get a more general solution for this "loop" that is
created, we will probably be able to remove or scope down what's provided for
[HIVE-25275](https://issues.apache.org/jira/browse/HIVE-25275).
Since the tickets are linked in Jira, I think we are good for now, we can
revisit it later upon finding a solution to the general problem.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]