[spark] Reduce paimon-spark-4.0 shadows via SparkShim copy factories#7721
Open
kerwin-zk wants to merge 1 commit intoapache:masterfrom
Open
[spark] Reduce paimon-spark-4.0 shadows via SparkShim copy factories#7721kerwin-zk wants to merge 1 commit intoapache:masterfrom
kerwin-zk wants to merge 1 commit intoapache:masterfrom
Conversation
7ded940 to
8276a71
Compare
This file contains hidden or 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
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.
Purpose
Follow-up to #7648 (Spark 4.1 module). After the reverse-shim layout landed, three of the files copied into
paimon-spark-4.0/src/mainonly differed across versions because ofcase class .copy(...)calls on Spark types whose arity changed between 4.0.2 and 4.1.1:DataSourceV2RelationgainedOption[TimeTravelSpec](8 → 9 fields) —relation.copy(table = ...)compiled against 4.1.1 emitscopy\$default\$9, which crashes on 4.0 withNoSuchMethodError.TableSpecgainedSeq[Constraint](8 → 9 fields) — same problem forspec.copy(location = ...)andspec.copy(properties = ...).Per-version scalac is the only thing that knows the right
copy\$default\$Nto emit, so we route those three calls through newSparkShimfactories (one per call site). The implementations live inSpark3Shim/Spark4Shim(plus the 4.0 override), and the cross-version source files no longer need to be physically duplicated.Tests
CI
API and Format
No new public API. Three internal helper methods added to
org.apache.spark.sql.paimon.shims.SparkShim:copyDataSourceV2Relation(relation, newTable)copyTableSpecLocation(spec, location)copyTableSpecProperties(spec, properties)