-
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
Remove Transformed
enum
#8835
Remove Transformed
enum
#8835
Conversation
c75a5ba
to
6094565
Compare
6094565
to
339c958
Compare
@alamb, I don't see any reason why we wrap the nodes into |
If it is not actually used I agree it makes sense to remove it I thought it was used at some point to avoid unecessary tree traversals somehow, though if you didn't find any evidence of that maybe it has been removed 🤔 Maybe @yahoNanJing or @liukun4515 can remember |
The There is a comment It does seem useful to know if a rule transformed the plan or not without having to perform an expensive plan comparison. This functionality does not seem to be used within DataFusion though. I wonder if downstream projects are making use of this public API? I'd also like to see if we can get an opinion from @yahoNanJing or @liukun4515 |
Basically if @yahoNanJing and/or @liukun4515 agree, I think we should merge this PR to make the API simpler. It will be a breaking change for anyone who has tree node transforms (e.g our custom optimizer passes in IOx) but the changes will be mechanical |
Thanks @peter-toth. I haven't come across any use cases yet, so it's a simplification. However, I wonder if PR #8817 can be merged beforehand? I plan to reopen it today. |
IMO the current form of #8817 has very fundamental issues: #8817 (comment). |
The enum If we removed the enum, it will bring a few cost to achieve this. Currently, the optimization rules in the Datafusion are actually not plenty. And this trait of TreeNode is quite fundamental and we need to consider more about the future extension. Therefore, I'm with a conservative point of view to remove this enum. |
Currently we don't seem to propagate up the |
fwiw, in the logical optimizer, rules return a |
Let me give you a bit more details to this issue that might help to decide how to proceed with the
So my point is that:
BTW, if you think that keeping the |
Thanks @peter-toth.
Yes, I agree it's not used currently.
Yes, it seems the And you are correct and the current interface may not be correct. How about changing the interface like this:
Then we can leverage the |
Yes, that's one of the options if we want to keep fn transform_up<F>(self, f: &F) -> Result<(Self, bool)>
where
F: Fn(Self) -> Result<(Self, bool)>,
{
self.map_children(|node| node.transform_up(f)).and_then(
|(node_with_new_children, children_transformed)| {
f(node_with_new_children).map(
|(new_node_with_new_children, transformed)| {
(
new_node_with_new_children,
children_transformed || transformed,
)
},
)
},
)
} We could also type alias
|
Thanks @peter-toth. I'm OK to change the Enum to your proposals. And we can wait for other PRs to do this change. |
FYI #8891 contains the fix to the |
Which issue does this PR close?
Closes #.
Rationale for this change
It seems there is no need for the
Transformed
enum so let's try getting rid of it.What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?