You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/07/12 19:58:55 UTC

[GitHub] [druid] rohangarg opened a new pull request #11434: Fix left join SQL queries with IS NOT NULL filter

rohangarg opened a new pull request #11434:
URL: https://github.com/apache/druid/pull/11434


   <!-- Thanks for trying to help us make Apache Druid be the best it can be! Please fill out as much of the following information as is possible (where relevant, and remove it when irrelevant) to help make the intention and scope of this PR clear in order to ease review. -->
   
   <!-- Please read the doc for contribution (https://github.com/apache/druid/blob/master/CONTRIBUTING.md) before making this PR. Also, once you open a PR, please _avoid using force pushes and rebasing_ since these make it difficult for reviewers to see what you've changed in response to their reviews. See [the 'If your pull request shows conflicts with master' section](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#if-your-pull-request-shows-conflicts-with-master) for more details. -->
   <!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
   
   <!-- If you are a committer, follow the PR action item checklist for committers:
   https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
   
   ### Description
   
   <!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
   
   <!-- Describe your patch: what did you change in code? How did you fix the problem? -->
   
   <!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
   This PR fixes the incorrect results for query : `SELECT dim1, l1.k FROM foo LEFT JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k WHERE l1.k IS NOT NULL` (in `CalciteQueryTests`)
   In the current code, the `WHERE` clause gets removed from the top of the left join and is pushed to the table `foo` 
   leading to incorrect results.
   The fix for such a situation is done by : 
   1. Converting such left joins into inner joins (since logically the mentioned left join query is equivalent to an inner join) using Calcite while maintaining that the druid execution layer can execute such inner joins.
   2. Preferring converted inner joins over original left joins in our cost model
   <!--
   In each section, please describe design decisions made, including:
    - Choice of algorithms
    - Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
    - Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
    - Method organization and design (how the logic is split between methods, parameters and return types)
    - Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
   -->
   
   
   <!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
   
   <!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
   
   <!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   - [x] been self-reviewed.
      - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
   - [x] added documentation for new or modified features or behaviors.
   - [x] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [x] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] abhishekagarwal87 commented on a change in pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on a change in pull request #11434:
URL: https://github.com/apache/druid/pull/11434#discussion_r673680040



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rule/DruidJoinRule.java
##########
@@ -243,15 +248,30 @@ static boolean canHandleCondition(final RexNode condition, final RelDataType lef
 
       if (isLeftExpression(operands.get(0), numLeftFields) && isRightInputRef(operands.get(1), numLeftFields)) {
         equalitySubConditions.add(Pair.of(operands.get(0), (RexInputRef) operands.get(1)));
+        rightColumns.add((RexInputRef) operands.get(1));
       } else if (isRightInputRef(operands.get(0), numLeftFields)
                  && isLeftExpression(operands.get(1), numLeftFields)) {
         equalitySubConditions.add(Pair.of(operands.get(1), (RexInputRef) operands.get(0)));
+        rightColumns.add((RexInputRef) operands.get(0));
       } else {
         // Cannot handle this condition.
         return Optional.empty();
       }
     }
 
+    if (right != null && !DruidJoinQueryRel.computeRightRequiresSubquery(DruidJoinQueryRel.getSomeDruidChild(right))
+        && right instanceof DruidQueryRel) {
+      DruidQueryRel druidQueryRel = (DruidQueryRel) right;
+      if (druidQueryRel.getDruidTable().getDataSource() instanceof LookupDataSource) {
+        long distinctRightColumns = rightColumns.stream().map(RexSlot::getIndex).distinct().count();
+        if (distinctRightColumns > 1) {
+          // it means that the join's right side is lookup and the join condition contains both columns of lookup.
+          // currently, the native engine doesn't support this.

Review comment:
       ### 
   ```suggestion
             // it means that the join's right side is lookup and the join condition contains both key and value columns of lookup.
             // currently, the lookup datasource in the native engine doesn't support using value column in the join condition.
   ```

##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidJoinQueryRel.java
##########
@@ -316,6 +316,9 @@ public RelOptCost computeSelfCost(final RelOptPlanner planner, final RelMetadata
       cost = CostEstimates.COST_JOIN_SUBQUERY;
     } else {
       cost = partialQuery.estimateCost();
+      if (joinRel.getJoinType() == JoinRelType.INNER) {

Review comment:
       this behaviour should be controllable through a feature flag. 

##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rule/DruidJoinRule.java
##########
@@ -243,15 +248,30 @@ static boolean canHandleCondition(final RexNode condition, final RelDataType lef
 
       if (isLeftExpression(operands.get(0), numLeftFields) && isRightInputRef(operands.get(1), numLeftFields)) {
         equalitySubConditions.add(Pair.of(operands.get(0), (RexInputRef) operands.get(1)));
+        rightColumns.add((RexInputRef) operands.get(1));
       } else if (isRightInputRef(operands.get(0), numLeftFields)
                  && isLeftExpression(operands.get(1), numLeftFields)) {
         equalitySubConditions.add(Pair.of(operands.get(1), (RexInputRef) operands.get(0)));
+        rightColumns.add((RexInputRef) operands.get(0));
       } else {
         // Cannot handle this condition.
         return Optional.empty();
       }
     }
 
+    if (right != null && !DruidJoinQueryRel.computeRightRequiresSubquery(DruidJoinQueryRel.getSomeDruidChild(right))

Review comment:
       can you also add an explanation for checking `DruidJoinQueryRel.computeRightRequiresSubquery` - i.e. in if it requires a sub-query, even joining a lookup will use a querydatasource. 

##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rule/FilterJoinExcludePushToChildRule.java
##########
@@ -292,4 +299,43 @@ private static boolean classifyFilters(List<RexNode> filters,
     // Did anything change?
     return !filtersToRemove.isEmpty();
   }
+
+  private void removeRedundantIsNotNullFilters(List<RexNode> joinFilters, JoinRelType joinType)

Review comment:
       can you add a brief explanation of what is happening here? 




-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rohangarg commented on a change in pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rohangarg commented on a change in pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
rohangarg commented on a change in pull request #11434:
URL: https://github.com/apache/druid/pull/11434#discussion_r668824638



##########
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) {
+        equalityFiltersOperandBuilder.add(new Pair<>(operands.get(0), operands.get(1)));

Review comment:
       Yes, I too think that it should never be null. But for safety, I've added null checks to the operands. I think we wouldn't want to compare the is-null-filter to an equals filter which contains a null operand. Also, I've added checks for `RexCall` object since in the original calcite rule too, there is no assumption that the filter would always be an object of RexCall. They too do an instance check before casting.




-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] abhishekagarwal87 commented on pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11434:
URL: https://github.com/apache/druid/pull/11434#issuecomment-885718864


   Thanks, @rohangarg for your contribution. I have merged the change. 


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rohangarg commented on pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
rohangarg commented on pull request #11434:
URL: https://github.com/apache/druid/pull/11434#issuecomment-885484840


   the tests are passing now - PTAL @clintropolis @abhishekagarwal87 


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rohangarg commented on a change in pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
rohangarg commented on a change in pull request #11434:
URL: https://github.com/apache/druid/pull/11434#discussion_r669603394



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rule/DruidJoinRule.java
##########
@@ -283,7 +283,8 @@ static boolean canHandleCondition(final RexNode condition, final RelDataType lef
 
   private static boolean isLeftExpression(final RexNode rexNode, final int numLeftFields)
   {
-    return ImmutableBitSet.range(numLeftFields).contains(RelOptUtil.InputFinder.bits(rexNode));
+    ImmutableBitSet inputBitSet = RelOptUtil.InputFinder.bits(rexNode);
+    return !inputBitSet.isEmpty() && ImmutableBitSet.range(numLeftFields).contains(inputBitSet);

Review comment:
       Also, this new check passes all the tests but fails to compile the query `SELECT dim1, l1.k FROM foo INNER JOIN (select k || '' as k from lookup.lookyloo group by 1) l1 ON foo.dim1 = l1.k and l1.k = 'abc'` 
   will think more about fixing the original issue without modifying the condition strictness in equi-conditions.




-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] abhishekagarwal87 commented on pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11434:
URL: https://github.com/apache/druid/pull/11434#issuecomment-885517479


   LGTM @rohangarg.  Please do add a test case to check that the null filter doesn't get removed if there is no equality condition on the column used in the null filter.  


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rohangarg commented on pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
rohangarg commented on pull request #11434:
URL: https://github.com/apache/druid/pull/11434#issuecomment-884399164


   the last 4 commits are new, they contain changes for review comments. Also, added check for sql-compat in the rewrite since in the non-sql-compat mode, the removal of `is not null` filter on join columns in an inner join could lead to incorrect results. 


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] abhishekagarwal87 merged pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 merged pull request #11434:
URL: https://github.com/apache/druid/pull/11434


   


-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] clintropolis commented on a change in pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
clintropolis commented on a change in pull request #11434:
URL: https://github.com/apache/druid/pull/11434#discussion_r668562159



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rule/DruidJoinRule.java
##########
@@ -283,7 +283,8 @@ static boolean canHandleCondition(final RexNode condition, final RelDataType lef
 
   private static boolean isLeftExpression(final RexNode rexNode, final int numLeftFields)
   {
-    return ImmutableBitSet.range(numLeftFields).contains(RelOptUtil.InputFinder.bits(rexNode));
+    ImmutableBitSet inputBitSet = RelOptUtil.InputFinder.bits(rexNode);
+    return !inputBitSet.isEmpty() && ImmutableBitSet.range(numLeftFields).contains(inputBitSet);

Review comment:
       might be worth leaving a comment about why the bitset shouldn't be empty

##########
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) {
+        equalityFiltersOperandBuilder.add(new Pair<>(operands.get(0), operands.get(1)));

Review comment:
       Can operands ever really be `null` valued here or will they always be a `RexNode`? Naively I would think not, and if true, I suggest maybe using `NonnullPair` instead.

##########
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:
       should this be an else if?




-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] rohangarg commented on a change in pull request #11434: Fix left join SQL queries with IS NOT NULL filter

Posted by GitBox <gi...@apache.org>.
rohangarg commented on a change in pull request #11434:
URL: https://github.com/apache/druid/pull/11434#discussion_r668793387



##########
File path: sql/src/main/java/org/apache/druid/sql/calcite/rule/DruidJoinRule.java
##########
@@ -283,7 +283,8 @@ static boolean canHandleCondition(final RexNode condition, final RelDataType lef
 
   private static boolean isLeftExpression(final RexNode rexNode, final int numLeftFields)
   {
-    return ImmutableBitSet.range(numLeftFields).contains(RelOptUtil.InputFinder.bits(rexNode));
+    ImmutableBitSet inputBitSet = RelOptUtil.InputFinder.bits(rexNode);
+    return !inputBitSet.isEmpty() && ImmutableBitSet.range(numLeftFields).contains(inputBitSet);

Review comment:
       I added the empty check since without this (with the new changes), the `testFilterAndGroupByLookupUsingJoinOperator` was failing with `org.apache.druid.java.util.common.IAE: Cannot join lookup with condition referring to non-key column: (("dim2" == "j0.k") && ('xa' == "j0.v"))
   	at org.apache.druid.segment.join.lookup.LookupJoinMatcher.create(LookupJoinMatcher.java:201)`.
   The reason was that the left join in the query was getting converted to inner join with condition `foo.dim2 = lookyloo.k && lookyloo.v = 'xa'` which the lookup join matcher can't handle.
   But now when I think of it more, I think this could generate sup-optimal plans for the IndexedTableMatcher which doesn't have such strict checks on the equi conditions.




-- 
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: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org