adriangb commented on code in PR #20331:
URL: https://github.com/apache/datafusion/pull/20331#discussion_r2852423501


##########
datafusion/physical-expr/src/expressions/dynamic_filters.rs:
##########
@@ -86,6 +108,11 @@ struct Inner {
     /// This is redundant with the watch channel state, but allows us to 
return immediately
     /// from `wait_complete()` without subscribing if already complete.
     is_complete: bool,
+    /// Per-partition filter expressions for partition-index routing.
+    /// When both sides of a hash join preserve their file partitioning (no 
RepartitionExec(Hash)),
+    /// build-partition i corresponds to probe-partition i. This allows 
storing per-partition
+    /// filters so that each partition only sees its own bounds, giving 
tighter filtering.
+    partitioned_exprs: PartitionedFilters,
 }

Review Comment:
   > In the record batch right before calling `evalute()` on the dynamic filter 
expression, we could introduce a new column with the partition index. I think 
you already explored this without success, but I would like to understand 
better what blockers specifically you faced, I do see this approach yielding a 
potential good result.
   
   I also was thinking this approach should work.
   
   Just throwing darts at the wall in terms of helping w/ implementation: you 
could create a marker expression e.g. `impl PhysicalExpr for PartitionLiteral` 
and then modify the machinery that replaces hive partition values in scans w/ 
the actual literals to also replace that with the DataFusion partition integer.
   
   
https://github.com/apache/datafusion/blob/e937cadbcceff6a42bee2c5fc8d03068fa0eb30c/datafusion/physical-expr-adapter/src/schema_rewriter.rs#L46-L83
   
   
https://github.com/apache/datafusion/blob/e937cadbcceff6a42bee2c5fc8d03068fa0eb30c/datafusion/datasource-parquet/src/opener.rs#L217-L261
   
   You'd have to contend with "what if this expression is evaluated without 
replacement". I'm not sure when / why that would happen, or if it's okay that 
the expression only works in the context of a scan. Maybe just returning null 
by default is reasonable behavior.



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