-
Notifications
You must be signed in to change notification settings - Fork 28k
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
[SPARK-48113][CONNECT] Allow Plugins to integrate with Spark Connect #46364
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HyukjinKwon
approved these changes
May 3, 2024
HyukjinKwon
reviewed
May 3, 2024
...ver/src/test/scala/org/apache/spark/sql/connect/plugin/SparkConnectPluginRegistrySuite.scala
Outdated
Show resolved
Hide resolved
Could you re-trigger CIs, @tomvanbussel ? |
Merged to master. |
JacobZheng0927
pushed a commit
to JacobZheng0927/spark
that referenced
this pull request
May 11, 2024
### What changes were proposed in this pull request? This PR enables Spark Connect plugins to process `Relation`s and `Expression`s using `SparkConnectPlanner` on the server side and to create `DataFrame`s using `Relation`s on the client side. This has been difficult due to the shading of the protobuf libraries, which meant that Java classes generated for the plugin's Protobuf message usage different base classes than the Java classes for Spark's protobuf messages. This was previously worked around by adding methods that accept a byte array (containing a serialized protobuf message) instead of a protobuf message. Unfortunately, this was not scalable as a lot of methods (such as `DataTypeProtoConverter.toCatalystType`) did not have this alternative. Luckily, we can avoid having to do this as the generated Java classes are not shaded and can still be used from plugins. Instead, plugins should serialize their own version of the generated Java classes for Spark Connect's protobuf messages and then parse them using Spark's (using the `ConnectProtoUtils` added in this PR). ### Why are the changes needed? Enable the development of Spark Connect plugins. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing tests ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#46364 from tomvanbussel/SPARK-48113. Authored-by: Tom van Bussel <tom.vanbussel@databricks.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
What's a Spark Connect Plugin? And where can we read some documentation about how to create one? I see there is this blog post describing how to extend Spark Connect, but I assume we have (or should have) our own documentation about this, no? |
Looks like the docs I am looking for are in #45340. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR enables Spark Connect plugins to process
Relation
s andExpression
s usingSparkConnectPlanner
on the server side and to createDataFrame
s usingRelation
s on the client side. This has been difficult due to the shading of the protobuf libraries, which meant that Java classes generated for the plugin's Protobuf message usage different base classes than the Java classes for Spark's protobuf messages. This was previously worked around by adding methods that accept a byte array (containing a serialized protobuf message) instead of a protobuf message. Unfortunately, this was not scalable as a lot of methods (such asDataTypeProtoConverter.toCatalystType
) did not have this alternative. Luckily, we can avoid having to do this as the generated Java classes are not shaded and can still be used from plugins. Instead, plugins should serialize their own version of the generated Java classes for Spark Connect's protobuf messages and then parse them using Spark's (using theConnectProtoUtils
added in this PR).Why are the changes needed?
Enable the development of Spark Connect plugins.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing tests
Was this patch authored or co-authored using generative AI tooling?
No