rohangarg commented on a change in pull request #11434:
URL: https://github.com/apache/druid/pull/11434#discussion_r668821143
##########
File path:
sql/src/main/java/org/apache/druid/sql/calcite/rule/FilterJoinExcludePushToChildRule.java
##########
@@ -292,4 +298,42 @@ private static boolean classifyFilters(List<RexNode>
filters,
// Did anything change?
return !filtersToRemove.isEmpty();
}
+
+ private void removeRedundantIsNotNullFilters(List<RexNode> joinFilters,
JoinRelType joinType)
+ {
+ if (joinType != JoinRelType.INNER) {
+ return; // only works for inner joins
+ }
+
+ ImmutableList.Builder<RexNode> isNotNullFiltersBuilder =
ImmutableList.builder();
+ ImmutableList.Builder<Pair<RexNode, RexNode>>
equalityFiltersOperandBuilder = ImmutableList.builder();
+
+ for (RexNode joinFilter : joinFilters) {
+ List<RexNode> operands = ((RexCall) joinFilter).getOperands();
+ if (joinFilter.isA(SqlKind.IS_NOT_NULL)) {
+ isNotNullFiltersBuilder.add(joinFilter);
+ }
+ if (joinFilter.isA(SqlKind.EQUALS) && operands.size() == 2) {
Review comment:
I think just `if` should also work since they are different kinds
according to calcite. But changed the code to else if for better readability.
--
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]