shrirangmhalgi opened a new pull request, #56904: URL: https://github.com/apache/spark/pull/56904
### What changes were proposed in this pull request? Add TimeType support to PostgresDialect: - `toCatalystType`: map time array elements to TimeType when `spark.sql.timeType.enabled` is true (previously mapped to `TimestampType` via `getTimestampType`) - `getJDBCType`: add `TimeType => TIME` for PostgreSQL-idiomatic DDL on write ### Why are the changes needed? This is a followup to #56653 which added core JDBC TIME support in `JdbcUtils`. That PR handled non-array read/write correctly via the base implementation, but PostgresDialect has its own `toCatalystType` helper for array element type resolution which still mapped `time` to `TimestampType` unconditionally. This caused PostgreSQL `time[]` array columns to be read with incorrect types when `spark.sql.timeType.enabled` is true. The write path also lacked a dialect-specific override, falling through to `TIME(6)` which works but is not idiomatic for PostgreSQL (which defaults to microsecond precision with bare `TIME`). ### Does this PR introduce _any_ user-facing change? Yes. When `spark.sql.timeType.enabled` is true, PostgreSQL time array columns now correctly infer as `ArrayType(TimeType)` instead of `ArrayType(TimestampType)`. Non-array TIME columns were already handled by the base JdbcUtils. ### How was this patch tested? Added two integration tests to `PostgresIntegrationSuite`: - **Read test**: verifies existing bar table TIME column (c36) is read as TimeType with correct value - **Round-trip test**: writes three LocalTime values (midnight, midday with sub-second, end-of-day) and reads them back, asserting type and value preservation ### Was this patch authored or co-authored using generative AI tooling? CoAuthored using Claude Opus 4.6 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
