Conversation
Spark 3.4 exposes the five-argument TableOutputResolver API. Add its version-specific Compatibility implementation instead of reusing the Spark 3.5 six-argument call, which aborts format writes with a NoSuchMethodError. Validated FormatTableTest on Spark 3.4.3 with Scala 2.12 and Scala 2.13: 33 tests passed for each variant, with standard Maven verify.
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
Format tables with
spark.paimon.format-table.implementation=paimonreject writes underspark.sql.storeAssignmentPolicy=LEGACYbecause Spark's generic V2 analyzer disallows that policy. For example, inserting the string'123'into aBIGINTcolumn fails before the write.Resolve these writes through Spark's
TableOutputResolver, allowing LEGACY casts and column alignment without changing the SQL. Keep the table schema fixed: missing, extra, or incompatible columns remain errors, and existing writer-side NOT NULL checks are retained. Invalid string-to-number casts produce NULL under LEGACY.Only Paimon format tables under LEGACY opt into this resolution. ANSI/STRICT assignments and the
engineimplementation retain their existing paths. Spark 3.2 uses a scoped configuration override so LEGACY casts remain independent of ANSI expression evaluation.Tests
FormatTableTestpassed with standard Mavenverify:The eight added tests cover string casts with ANSI evaluation enabled and disabled, fixed schemas and by-name alignment, nested types, append and partition overwrite, ANSI/STRICT behavior, the engine V1 write path, NOT NULL enforcement and analyzer convergence, and the writer schema guard.