-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: remove the Sized requirement on ExecutionPlan::name() #11047
Conversation
Signed-off-by: Ruihang Xia <[email protected]>
Could we add a test to show that |
@@ -116,12 +116,7 @@ pub mod udaf { | |||
/// [`required_input_ordering`]: ExecutionPlan::required_input_ordering | |||
pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync { | |||
/// Short name for the ExecutionPlan, such as 'ParquetExec'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can also update the doc string to include a note about using static_name
if desired to help people migrate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point 👍 I add an implementation note section in doc string
Co-authored-by: Andrew Lamb <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Certainly 👍 Add a compilation test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me -- thank you @waynexia and @matthewmturner
@@ -931,6 +940,14 @@ mod tests { | |||
assert_eq!(renamed_exec.name(), "MyRenamedEmptyExec"); | |||
assert_eq!(RenamedEmptyExec::static_name(), "MyRenamedEmptyExec"); | |||
} | |||
|
|||
/// A compilation test to ensure that the `ExecutionPlan::name()` method can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me -- thank you @waynexia and @matthewmturner
Thanks @matthewmturner @alamb ❤️ |
) * fix: remove the Sized requirement on ExecutionPlan::name() Signed-off-by: Ruihang Xia <[email protected]> * Update datafusion/physical-plan/src/lib.rs Co-authored-by: Andrew Lamb <[email protected]> * add document and test Signed-off-by: Ruihang Xia <[email protected]> --------- Signed-off-by: Ruihang Xia <[email protected]> Co-authored-by: Andrew Lamb <[email protected]>
Which issue does this PR close?
Follow-up of #10266
Rationale for this change
#10266 tries to provide a default implementation based on
static_name()
. This propagates theSized
requirement toname()
and prohibits it from being called by a trait object.What changes are included in this PR?
Remove the default implementation of
ExecutionPlan::name()
and let every implementor implement their own based onstatic_name()
to workaround object safety requirements. This is something likeas_any()
.This solution is not elegant, but I can only find this way to suit both (1) invoke from trait object and (2) invoke from type name. Please add your suggestion if there is any better way to do so. Thanks in advance!
Are these changes tested?
Are there any user-facing changes?
Yes, for those who implements
ExecutionPlan
, they need to add a new method onimpl