-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Fix classloading issue with OutputNode PlanNode #19265
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
Conversation
947d182 to
ee6613b
Compare
6fc9d7c to
e90cd7a
Compare
e90cd7a to
692a5fc
Compare
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.
why did this change from Immutable to unmodifiable?
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.
Presto SPI packages do not use guava. Since we are moving this class to SPI, we need to find alternatives for Guava.
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.
It's also a good idea to replace Guava and similar libraries with JDK methods where available. A lot of Guava, Apache commons collections, and the like exist primarily to provide utilities that are available in JDK 8+ for earlier JDK versions.
|
why is this specific to output node and not all plan nodes? |
For all plan nodes that we anticipate a pluggable analyzer to use, this would hold true. However, for internal plan nodes (such as ExchangeNode), which are not utilized by the analyzer, this would not be the case. In the present range of query shapes that Crux supports, the only missing class was the OutputNode. |
That would include most plan nodes then. Currently very few plan nodes are in the spi. we'll need to add almost all of them over. |
|
Not all, only those which are required while constructing logical plan nodes. Nodes added during optimization phase are not required. At the moment following nodes are defined nodes and related classes are used by inbuilt analyzer. Which potentially we would need to migrate to SPI. com.facebook.presto.sql.planner.plan.DeleteNode; We have following options:
At this point I have taken the approach 1. |
|
I discussed offline with @rschlussel and we have agreed to go with approach 2. I will update the PR by fixing more plan nodes, which would be used by analyzers plugins. |
OutputNode plan class is used for creating logical plan. Now logical plan creation is part of the pluggable analyzer interface, respective analyzer plugins are expected to use OutputNode class. Previously, the OutputNode class was extended from InternalPlanNode, which required it to be available with AppClassLoader. However, since the analyzer plugins now instantiate the OutputNode class, it and its dependencies are loaded by PluginClassLoader, making it unavailable for the rest of the AppClassLoader. To fix this issue, we are extending OutputNode from PlanNode instead of InternalPlanNode and also moving it to the spi package, as it is anyways expected to be leveraged by plugins. This also whitelists this class for PluginClassLoader. The other alternative would have been to add com.facebook.presto.sql.planner package to the whitelists for PluginClassLoader, however that would have added to many classes to the whitelist which is not necessary.
692a5fc to
3e5a345
Compare
elharo
left a comment
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.
com.facebook.presto.sql.planner.plan.OutputNode appears to be public API. Who's affected by removing it?
@elharo we are not removing it, we have moved to spi package, which makes it even more official. SPI package in general is very well understood by plugins owner. |
rschlussel
left a comment
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.
We discussed, and not all nodes can be easily moved to the spi, so some work is needed there. We'll start with just the OutputNode to unblock testing an end to end flow for a simple query with a plugin analyzer. We'll migrate the rest of the nodes afterwards.
|
@jainxrohit Rohit, it seem like this change broken Sapphire-Native. CC: @miaoever @tanjialiang |
Fixed in the #19284 |
OutputNode plan class is used for creating logical plan. Now logical plan creation is part of the pluggable analyzer interface, respective analyzer plugins are expected to use OutputNode class.
Previously, the OutputNode class was extended from InternalPlanNode, which required it to be available with AppClassLoader. However, since the analyzer plugins now instantiate the OutputNode class, it and its dependencies are loaded by PluginClassLoader, making it unavailable for the rest of the AppClassLoader.
To fix this issue, we are extending OutputNode from PlanNode instead of InternalPlanNode and also moving it to the spi package, as it is anyways expected to be leveraged by plugins. This also whitelists this class for PluginClassLoader.
The other alternative would have been to add com.facebook.presto.sql.planner package to the whitelists for PluginClassLoader, however that would have added to many classes to the whitelist which is not necessary.