uros-b commented on code in PR #57680:
URL: https://github.com/apache/spark/pull/57680#discussion_r3700468364


##########
sql/core/src/test/resources/sql-tests/inputs/timestamp-ltz-nanos.sql:
##########
@@ -182,6 +182,24 @@ SELECT TIMESTAMP_LTZ '1960-01-31 03:04:05.123456789 UTC' + 
INTERVAL '1' MONTH;
 -- legacy calendar interval is still rejected by TimestampAddInterval's type 
check.
 SELECT TIMESTAMP_LTZ '2020-01-02 03:04:05.123456789 UTC' + make_interval(0, 1, 
0, 2, 0, 0, 0);
 
+-- SPARK-57832: TIMESTAMP_LTZ(p) - TIMESTAMP_LTZ(p) yields a microsecond-grid 
DayTimeIntervalType.
+-- Only each operand's epochMicros participates, so the sub-microsecond 
remainder is truncated: the
+-- 789/111 sub-micro digits drop out and the difference is exactly 1 day + 
0.123456 s. Instant
+-- subtraction is zone-agnostic, so the session time zone does not change the 
interval magnitude.

Review Comment:
   “Instant subtraction is zone-agnostic…” is not accurate for LTZ. 
subtractTimestamps uses session-zone local datetimes, so DST can change the 
interval vs a raw instant diff (same as micro TIMESTAMP). Worth fixing the 
comment.



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