Uh oh!
There was an error while loading. Please reload this page.
Remove Transformed enum - #8835
Conversation
c75a5ba to
6094565Compare6094565 to
339c958Comparepeter-toth
commented
Jan 12, 2024
@alamb, I don't see any reason why we wrap the nodes into |
alamb
commented
Jan 12, 2024
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 |
alamb
commented
Jan 14, 2024
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 |
berkaysynnada
commented
Jan 15, 2024
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). |
yahoNanJing
commented
Jan 15, 2024
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 |
andygrove
commented
Jan 15, 2024
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 fntransform_up<F>(self,f:&F) -> Result<(Self,bool)>whereF: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 |
yahoNanJing
commented
Jan 19, 2024
Thanks @peter-toth. I'm OK to change the Enum to your proposals. And we can wait for other PRs to do this change. |
peter-toth
commented
Feb 2, 2024
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
Transformedenum 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?