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 2020/04/28 23:00:18 UTC
[GitHub] [druid] suneet-s opened a new issue #9787: Filter pushdown for joins do not work a non-matching condition is on the RHS
suneet-s opened a new issue #9787:
URL: https://github.com/apache/druid/issues/9787
### Affected Version
0.18
### Description
See the following CalciteQueryTest
```
@Test
public void testFilterAndGroupByLookupUsingJoinOperatorWithValueFilterPushdownMatchesNothig() throws Exception
{
// Cannot vectorize JOIN operator.
cannotVectorize();
Map<String, Object> queryRewriteValueColumnFiltersContext = DEFAULT_QUERY_CONTEXT_BUILDER
.put(QueryContexts.JOIN_FILTER_REWRITE_VALUE_COLUMN_FILTERS_ENABLE_KEY, true)
.build();
testQuery(
"SELECT lookyloo.k, COUNT(*)\n"
+ "FROM foo LEFT JOIN lookup.lookyloo ON foo.dim2 = lookyloo.k\n"
+ "WHERE lookyloo.v = '123'\n"
+ "GROUP BY lookyloo.k",
queryRewriteValueColumnFiltersContext,
ImmutableList.of(
GroupByQuery.builder()
.setDataSource(
join(
new TableDataSource(CalciteTests.DATASOURCE1),
new LookupDataSource("lookyloo"),
"j0.",
equalsCondition(DruidExpression.fromColumn("dim2"), DruidExpression.fromColumn("j0.k")),
JoinType.LEFT
)
)
.setInterval(querySegmentSpec(Filtration.eternity()))
.setDimFilter(selector("j0.v", "123", null))
.setGranularity(Granularities.ALL)
.setDimensions(dimensions(new DefaultDimensionSpec("j0.k", "d0")))
.setAggregatorSpecs(aggregators(new CountAggregatorFactory("a0")))
.setContext(queryRewriteValueColumnFiltersContext)
.build()
),
ImmutableList.of()
);
}
```
Since the filter `lookyloo.v = '123'` matches nothing, Druid treats this as if filter pushdown was disabled so it needs to do the hash join for every row in the fact table only to realize that the dimension does not match.
The filter pushdown mechanism should handle the following cases
* can't push down for some reason (like disabled by config)
* non-existent column
* no matches
* matches some values
----------------------------------------------------------------
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.
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] jon-wei closed issue #9787: Optimize JOIN on dimension table where filter matches nothing
Posted by GitBox <gi...@apache.org>.
jon-wei closed issue #9787:
URL: https://github.com/apache/druid/issues/9787
----------------------------------------------------------------
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.
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