Repository navigation
datafusion-physical-expr: add DynamicFilterPhysicalExpr::update_from(Self) method - #26534
jayshrivastava wants to merge 4 commits into
Conversation
DynamicFilterPhysicalExpr::update_from(Self) method
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #26534 +/- ##
==========================================
+ Coverage 82.91% 82.94% +0.02%
==========================================
Files 1155 1156 +1
Lines 458058 458717 +659
Branches 458058 458717 +659
==========================================
+ Hits 379813 380489 +676
+ Misses 55202 55148 -54
- Partials 23043 23080 +37 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| current.generation += 1; | ||
| current.expr = source_state.expr; | ||
| current.is_complete |= source_state.is_complete; |
There was a problem hiding this comment.
Once current.is_complete is true, consumers may stop tracking this filter because the API contract says its expression will no longer change. However, update_from can still replace the expression of an already-complete target while preserving is_complete = true.
The final step of test_update_from_notifies_waiters_and_preserves_completion appears to exercise this case: the target is complete with lit(false), then receives the incomplete snapshot containing lit(true). The target therefore remains complete but its expression changes.
Could update_from reject or ignore updates when the target is already complete? A regression assertion that the expression, generation, and watch state remain unchanged would also help protect the terminal completion contract.
Which issue does this PR close?
What changes are included in this PR?
This PR adds a helper similar to
DynamicFilterPhysicalExpr::update()which takes a differentDynamicFilterPhysicalExpr.Rationale for this change
The use case I have is that I want to update a
Arc<DynamicFilterPhysicalExpr>from a differentArc<DynamicFilterPhysicalExpr>(as opposed to the normalupdate()API which takes a non dynamic filterArc<dyn PhysicalExpr>).This requires accessing private fields like
Inner. Rather than exposing private fields, I thought that adding anupdate_from(Self)API is cleaner.Note that you cannot call
because
a) it doesn't copy
is_completeb) it doesn't copy
inner.exprdirectly.current()returns the expression with remapped columns and callingdynamic_filter_expr.update(remapped_expression); dynamic_filter_expr.current()breaks becausecurrent()cannot remap the remapped expression.Alternatives Considered
inner.exprandis_completepublic. This is undesirable because it adds overheadExecutionPlan. In a way, this is whatupdate_fromdoes, taking advantage of interior mutability.What is the testing strategy for this PR?
One unit test
Are there any user-facing changes?
No.