Max Gekk created SPARK-57501:
--------------------------------

             Summary: Add +/- ANSI day-time interval support for 
TIMESTAMP_NTZ(p)/TIMESTAMP_LTZ(p)
                 Key: SPARK-57501
                 URL: https://issues.apache.org/jira/browse/SPARK-57501
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 4.3.0
            Reporter: Max Gekk


h2. Problem

Spark supports arithmetic (+/-) between microsecond timestamp-family types and 
ANSI intervals, but TIMESTAMP_NTZ(p)/TIMESTAMP_LTZ(p) with precision p in [7, 
9] does not yet have parity for ANSI day-time interval arithmetic.

h2. Goal

Implement feature parity for:
* TIMESTAMP_NTZ(p) +/- ANSI day-time interval
* TIMESTAMP_LTZ(p) +/- ANSI day-time interval
where p in [7, 9].

Expected semantics:
* Preserve sub-microsecond timestamp precision (nanos remainder).
* Apply ANSI day-time interval using existing microsecond interval 
representation.
* Keep existing LTZ/NTZ timezone semantics unchanged.

h2. Scope

* Analyzer/type-resolution updates so timestamp nanos family is accepted in 
datetime arithmetic rules.
* Expression/runtime updates for timestamp +/- ANSI day-time interval on nanos 
timestamp values.
* Utility-layer support to perform arithmetic safely without dropping nanos 
remainder.
* Test coverage additions in catalyst and SQL suites for LTZ/NTZ nanos 
arithmetic parity.
* Golden output regeneration where analyzer expectations change.

h2. Non-Goals

* No redesign of ANSI day-time interval physical precision.
* No behavior changes for existing microsecond timestamp-family paths beyond 
parity alignment.

h2. Acceptance Criteria

* TIMESTAMP_NTZ(p)/TIMESTAMP_LTZ(p), p in [7, 9], supports +/- ANSI day-time 
intervals.
* Results preserve nanos remainder and match existing timestamp-family behavior 
otherwise.
* Interpreted and codegen paths both pass targeted tests.
* New/updated tests are added for catalyst and SQL coverage.

h2. Testing Plan

* Catalyst expression tests for add/subtract with ANSI day-time intervals on 
nanos timestamp types.
* SQL tests for timestamp-ntz-nanos and timestamp-ltz-nanos suites.
* Type-coercion/analyzer expectation updates validated via regenerated golden 
files.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to