asolimando commented on a change in pull request #2839:
URL: https://github.com/apache/hive/pull/2839#discussion_r761830232
##########
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()) {
Review comment:
For the `RelBuilder` use I think
[HiveFilterMergeRule](https://github.com/apache/hive/blob/cadf5f731c8cb0a4217d50de8a9b216eaaed1ea1/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveFilterMergeRule.java#L54)
is a good example, and it hides all the complexity.
However, when dealing directly with newly created `RexNode`s I am not sure
how to achieve that consistently.
Regarding option 3, it seems that at least in the case reported here it was
not enough: https://github.com/apache/hive/pull/2840. My impression is that, if
we don't simplify before hand, in some cases, `RexSimplify.simplify` is not
always able to perform the simplification afterwards, but I need to have a
better look.
--
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]