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 2022/08/12 07:50:43 UTC
[GitHub] [druid] abhishekagarwal87 commented on a diff in pull request #12894: Fix hasBuiltInFilters for joins converted to filters
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: 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