Skip to content

[SPARK-59051][SQL] Compile JDBC partition bounds with the dialect - #58536

Open
charliec05 wants to merge 1 commit into
apache:masterfrom
charliec05:codex/spark-59051-jdbc-bound-dialect
Open

[SPARK-59051][SQL] Compile JDBC partition bounds with the dialect#58536
charliec05 wants to merge 1 commit into
apache:masterfrom
charliec05:codex/spark-59051-jdbc-bound-dialect

Conversation

@charliec05

Copy link
Copy Markdown

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 to LocalDateTime values that preserve the existing configured-zone and zoneless semantics. Numeric bounds are unchanged.

Add regression coverage for DateType, TimestampType, and TimestampNTZType using 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant