[SPARK-59051][SQL] Compile JDBC partition bounds with the dialect - #58536
Open
charliec05 wants to merge 1 commit into
Open
[SPARK-59051][SQL] Compile JDBC partition bounds with the dialect#58536charliec05 wants to merge 1 commit into
charliec05 wants to merge 1 commit into
Conversation
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.
What changes were proposed in this pull request?
Resolve the JDBC dialect while constructing column partitions and route temporal partition-bound values through
JdbcDialect.compileValue.Date bounds are converted to
java.sql.Date, while timestamp and timestamp-without-time-zone bounds are converted toLocalDateTimevalues that preserve the existing configured-zone and zoneless semantics. Numeric bounds are unchanged.Add regression coverage for
DateType,TimestampType, andTimestampNTZTypeusing the Oracle dialect.Why are the changes needed?
Temporal partition bounds are currently emitted as bare quoted ISO strings, bypassing the configured JDBC dialect. Databases do not universally accept those literals. In particular, Oracle may interpret them according to session NLS formats, while its dialect already provides portable JDBC date and timestamp escape literals through
compileValue.Using the dialect makes generated partition predicates valid for the target database and reuses the existing literal compilation extension point.
Does this PR introduce any user-facing change?
Yes. JDBC partition predicates for date and timestamp columns now use dialect-compiled literals. For example, Oracle bounds use
{d '...'}and{ts '...'}instead of bare quoted strings.How was this patch tested?
Added regression coverage for all three temporal partition types and ran:
build/sbt "sql/Test/testOnly org.apache.spark.sql.jdbc.JDBCSuite"All 153 tests passed. The focused test was rerun after the final formatting adjustment. Also ran
dev/lint-scala; Scalastyle and Scalafmt passed.Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-5)