askalt commented on code in PR #20009:
URL: https://github.com/apache/datafusion/pull/20009#discussion_r2754637369
##########
datafusion/physical-plan/src/joins/hash_join/exec.rs:
##########
@@ -1384,6 +1386,55 @@ impl ExecutionPlan for HashJoinExec {
}
Ok(result)
}
+
+ fn physical_expressions<'a>(
+ &'a self,
+ ) -> Option<Box<dyn Iterator<Item = Arc<dyn PhysicalExpr>> + 'a>> {
+ self.filter
+ .as_ref()
+ .map(|f| Box::new(std::iter::once(Arc::clone(&f.expression))) as
Box<_>)
+ }
+
+ fn with_physical_expressions(
+ &self,
+ mut params: ReplacePhysicalExpr,
+ ) -> Result<Option<Arc<dyn ExecutionPlan>>> {
+ let expected_count = self.filter.iter().len();
+ let exprs_count = params.exprs.len();
+ assert_eq_or_internal_err!(
+ expected_count,
+ exprs_count,
+ "Inconsistent number of physical expressions for {}",
+ self.name()
+ );
+
+ let filter = self
+ .filter
+ .as_ref()
+ .zip(params.exprs.pop())
+ .map(|(f, expr)| {
+ JoinFilter::new(expr, f.column_indices.clone(),
Arc::clone(&f.schema))
+ });
+
+ Ok(Some(Arc::new(Self {
+ left: Arc::clone(&self.left),
+ right: Arc::clone(&self.right),
+ on: self.on.clone(),
+ filter,
+ join_type: self.join_type,
+ join_schema: Arc::clone(&self.join_schema),
+ left_fut: Arc::clone(&self.left_fut),
Review Comment:
Oh, I see, we need to cast from `Arc<dyn PhysicalExpr>` to
`Arc<DynamicFilterExpr>` (in `with_physical_expressions(...)`), which seems
cannot be done now. Actually, when we want to re-execute an existing plan, for
example:
```
HashJoinExec { dynamic_filter: e}
...
SomeNode { dynamic_filter: e }
...
```
We need to someway share a new version of `e` between owner (hash join exec)
and some node which polls this filter (because every `execute(...)` should
return stream with its own filter instance) . So if `physical_expr(...)`
returns dynamic filter, we can replace it with a new instance when we able to
re-execute the plan. It would be good, but it seems that we can omit in this PR
as it requires an additional design.
--
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]