aleksandar-trajkovic-db opened a new pull request, #60558:
URL: https://github.com/apache/spark/pull/60558

   ### What changes were proposed in this pull request?
   
   Write a pushed-down `java.time.Instant` literal the same way as the 
equivalent `java.sql.Timestamp` (wall clock in the JVM time zone) in the base 
and Oracle dialects; Oracle previously sent it unquoted and failed with 
`ORA-17041`. SQL Server keeps the session-time-zone literal, because 
`datetime2` and `datetimeoffset` need different zones. 
`spark.sql.legacy.jdbc.sessionZoneTimestampLiteral.enabled` restores the old 
behavior. Please also merge to branch-4.x.
   
   ### Why are the changes needed?
   
   1. Goal: a pushed-down TIMESTAMP filter returns the same rows as Spark 
evaluating it, for either `spark.sql.datetime.java8API.enabled` setting.
   2. Problem: with java8API on (always on in the Thrift server), the literal 
is written in the session time zone, but JDBC drivers read zoneless values in 
the JVM time zone. PostgreSQL, JVM time zone UTC:
      ```sql
      SET spark.sql.datetime.java8API.enabled=true;
      SET TIME ZONE 'America/Chicago';
      SELECT id FROM pg.events WHERE ts >= DATE '2026-06-26' AND ts < DATE 
'2026-06-27';
      ```
      Before: `"ts" >= '2026-06-26 00:00:00'` (returns the UTC day) -> Target: 
`"ts" >= '2026-06-26 05:00:00.0'` (the Chicago day, same as java8API off)
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. With java8API on and a session time zone that differs from the JVM time 
zone, pushed JDBC filters now return the same rows as without pushdown (except 
SQL Server, unchanged).
   
   ### How was this patch tested?
   
   New tests in `JDBCSuite` and `V2JDBCTest` (run by the PostgreSQL, MySQL, 
Oracle and DB2 docker suites).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Isaac (Claude Code, Claude Opus 5.5)
   
   This pull request and its description were written by Isaac.
   


-- 
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]

Reply via email to