Max Gekk created SPARK-57558:
--------------------------------
Summary: Add the LOCALTIME datetime value function
Key: SPARK-57558
URL: https://issues.apache.org/jira/browse/SPARK-57558
Project: Spark
Issue Type: Sub-task
Components: SQL
Affects Versions: 4.3.0
Reporter: Max Gekk
h2. What
Add the ANSI {{LOCALTIME}} datetime value function, returning the current local
time as
{{TIME}} (without time zone), with an optional precision argument
{{LOCALTIME(p)}}.
h2. Why
ANSI SQL (6.32 <datetime value function>) defines both {{CURRENT_TIME}} (TIME
WITH TIME
ZONE) and {{LOCALTIME}} (TIME WITHOUT TIME ZONE). Spark registers
{{current_time}},
{{current_timestamp}}, and {{localtimestamp}}, but not {{localtime}}. Since
Spark's TIME is
always WITHOUT TIME ZONE, {{LOCALTIME}} is the standard-named counterpart to
the existing
{{localtimestamp}}.
h2. Scope
* Register {{localtime}} in {{FunctionRegistry}} next to
{{current_time}}/{{localtimestamp}}.
* Implement as an expression returning {{TimeType(p)}} from the session-local
wall clock
(reuse the {{CurrentTime}} implementation / constant-folding in
{{finishAnalysis}}).
* Parser support for the reserved-word form {{LOCALTIME}} (no parentheses),
consistent with
{{LOCALTIMESTAMP}}.
h2. Acceptance criteria
* {{SELECT LOCALTIME}}, {{SELECT LOCALTIME()}}, {{SELECT localtime(3)}} all
return TIME at
the requested precision.
* Documented in the function reference; tests added.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]