[
https://issues.apache.org/jira/browse/SPARK-57837?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Max Gekk updated SPARK-57837:
-----------------------------
Shepherd: Max Gekk
> Support the precision argument in current_timestamp(p) and localtimestamp(p)
> ----------------------------------------------------------------------------
>
> Key: SPARK-57837
> URL: https://issues.apache.org/jira/browse/SPARK-57837
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 4.3.0
> Reporter: Max Gekk
> Priority: Major
>
> This sub-task is part of the umbrella SPARK-56822 (timestamps with nanosecond
> precision).
> h2. Problem
> Today {{current_timestamp}} / {{now}} / {{localtimestamp}} take no precision
> argument - {{CurrentTimestamp}} / {{Now}} are fixed {{TimestampType}} and
> {{LocalTimestamp}} fixed {{TimestampNTZType}} (datetimeExpressions.scala
> ~L191-268), registered without a builder ({{FunctionRegistry}} ~L701/705),
> and the parser produces {{CurrentTimestamp()}} with no args ({{AstBuilder}}
> ~L3589). ANSI SQL/Foundation defines an optional <timestamp precision> on
> both (Feature F555 "Enhanced seconds precision", std lines ~16669-16737),
> with {{LOCALTIMESTAMP(p) = CAST(CURRENT_TIMESTAMP(p) AS TIMESTAMP(p) WITHOUT
> TIME ZONE)}}.
> h2. Goal
> Accept an optional precision {{p}} in {{current_timestamp(p)}} and
> {{localtimestamp(p)}} for {{p}} in [7, 9] (when nanosecond types are
> enabled), returning the corresponding nanosecond LTZ/NTZ type.
> {{current_time(p)}} (timeExpressions.scala ~L489-534) is the existing
> precedent to mirror.
> h2. Scope
> Add precision-aware expression builders for the current-timestamp functions;
> return {{TimestampLTZNanosType(p)}} / {{TimestampNTZNanosType(p)}}; wire the
> value from the query's current instant with the nanosecond remainder; keep
> the no-arg forms as microsecond defaults.
> h2. Acceptance criteria
> * {{current_timestamp(9)}} / {{localtimestamp(9)}} return nanosecond-typed
> current time; no-arg forms unchanged.
> h2. Testing
> {{DateExpressionsSuite}} / {{ComputeCurrentTimeSuite}}; nanos golden files.
> h2. Dependencies
> None hard (builds on resolved ComputeCurrentTime SPARK-57748); reuses the
> internal nanosecond make-timestamp expressions surfaced by the make_timestamp
> sub-task.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]