abhishekagarwal87 commented on code in PR #12894:
URL: https://github.com/apache/druid/pull/12894#discussion_r944203041


##########
processing/src/main/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapter.java:
##########
@@ -212,8 +212,11 @@ public Metadata getMetadata()
   @Override
   public boolean hasBuiltInFilters()
   {
-    return clauses.stream()
-                  .anyMatch(clause -> clause.getJoinType() == JoinType.INNER 
&& !clause.getCondition().isAlwaysTrue());
+    // empty clause means that the join has been converted to a filter 
(captured in baseFilter). So, if the baseFilter
+    // non-null, then the adapter can potentially filter rows.
+    return (clauses.isEmpty() && baseFilter != null) || 
clauses.stream().anyMatch(
+        clause -> clause.getJoinType() == JoinType.INNER && 
!clause.getCondition().isAlwaysTrue()

Review Comment:
   if the baseFilter is not null, then rows from underlying storage can be 
filtered, no matter what is in the clauses. 



##########
processing/src/main/java/org/apache/druid/segment/join/HashJoinSegmentStorageAdapter.java:
##########
@@ -212,8 +212,11 @@ public Metadata getMetadata()
   @Override
   public boolean hasBuiltInFilters()
   {
-    return clauses.stream()
-                  .anyMatch(clause -> clause.getJoinType() == JoinType.INNER 
&& !clause.getCondition().isAlwaysTrue());
+    // empty clause means that the join has been converted to a filter 
(captured in baseFilter). So, if the baseFilter
+    // non-null, then the adapter can potentially filter rows.
+    return (clauses.isEmpty() && baseFilter != null) || 
clauses.stream().anyMatch(
+        clause -> clause.getJoinType() == JoinType.INNER && 
!clause.getCondition().isAlwaysTrue()

Review Comment:
   shouldn't this be 
   ```suggestion
       // empty clause means that the join has been converted to a filter 
(captured in baseFilter). So, if the baseFilter
       // non-null, then the adapter can potentially filter rows.
       return (baseFilter != null) || clauses.stream().anyMatch(
           clause -> clause.getJoinType() == JoinType.INNER && 
!clause.getCondition().isAlwaysTrue()
   ```



-- 
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]

Reply via email to