You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
It would be necessary to support filters in the join operator, instead of a join operator followed by a filter, the necessity comes from two folds:
semi-join that columns from one table would be removed after the join, which would make a filter that references both sides impossible.
filter out records earlier to reduce the need for constructing more records(batches).
Describe the solution you'd like
pub type FilterOn = (Vec<Column>, Vec<Column>, Arc<dyn PhysicalExpr>); and Option<FilterOn> for JoinExec.
generate record batch using arrays in the filter expr, but rebind the expr to point to the right columns of the newly generated batch.
Describe alternatives you've considered
pub type FilterOn = Vec<(Column, Column, datafusion_expr::Operator)>;
Normalize each filter into two sides of a binary op. like: t1.a + t2.b > 100 to t1.a > 100 - t2.b. evaluates a , 100-b separately as two columns and apply binary expr calculation logic.
But the approach would be quite limited since it greatly limits the expressions that could be used in a join filter.
Additional context
Consider Part of TPC-DS query-95's SparkSQL plan as an example:
@yjshen do you mind if I close this ticket and reopen another describing the support needed for Sort-merge? I think it might be clearer to a future reader that we just needed to extend the support in HashJoin to MergeJoin whereas the description of this ticket now may confuse people as it talks about differing implementation possibilities
Activity
yjshen commentedon May 11, 2022
A related issue #2496.
[-]Support optional filter in Join[/-][+]Support optional filter in SortMergeJoin[/+]yjshen commentedon May 26, 2022
Reopened and renamed to track sort-merge join filter as well.
alamb commentedon May 26, 2022
@yjshen do you mind if I close this ticket and reopen another describing the support needed for Sort-merge? I think it might be clearer to a future reader that we just needed to extend the support in HashJoin to MergeJoin whereas the description of this ticket now may confuse people as it talks about differing implementation possibilities
yjshen commentedon May 27, 2022
Get it; I will open a new issue instead.
[-]Support optional filter in SortMergeJoin[/-][+]Support optional filter in Join[/+]alamb commentedon May 27, 2022
Thanks @yjshen !