Max Gekk created SPARK-57819:
--------------------------------
Summary: Support nanosecond-precision timestamps in months_between
Key: SPARK-57819
URL: https://issues.apache.org/jira/browse/SPARK-57819
Project: Spark
Issue Type: Sub-task
Components: SQL
Affects Versions: 4.3.0
Reporter: Max Gekk
This sub-task is part of the umbrella SPARK-56822 (timestamps with nanosecond
precision).
h2. Problem
{{MonthsBetween}} (datetimeExpressions.scala ~L2461-2470) types its args as
{{Seq(TimestampType, TimestampType, BooleanType)}} and calls
{{DateTimeUtils.monthsBetween(Long, Long, ...)}}. Nanosecond args are cast to
microsecond LTZ, so the sub-microsecond part is ignored and NTZ nanos gets LTZ
semantics.
h2. Goal
Accept nanosecond timestamps and include the {{nanosWithinMicro}} remainder in
the fractional-month computation (matching how the microsecond path already
uses the sub-second time-of-day).
h2. Scope
Accept {{AnyTimestampNanoType}}; add a {{TimestampNanosVal}}-aware
{{monthsBetween}} path.
h2. Acceptance criteria
* {{months_between}} over nanosecond timestamps matches the microsecond result
when the remainder is zero and reflects sub-microsecond differences otherwise;
{{roundOff}} semantics preserved.
h2. Testing
{{DateExpressionsSuite}}; nanos golden files.
h2. Dependencies
None - independent.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]