Max Gekk created SPARK-57854:
--------------------------------
Summary: Support the parenthesized interval-qualified datetime
difference syntax
Key: SPARK-57854
URL: https://issues.apache.org/jira/browse/SPARK-57854
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-57550 (extend support for the TIME
data type).
h2. Problem
ANSI defines a parenthesized, interval-qualified datetime difference, e.g.
{{(t1 - t2) DAY TO SECOND}} / {{(t1 - t2) HOUR}} (std ~L16762-16763). Spark
only supports the bare {{t1 - t2}} form, which for TIME yields a fixed
{{DayTimeIntervalType(HOUR, SECOND)}} ({{SubtractTimes}}). There is no
parser/resolver support for the qualified form.
h2. Goal
Add grammar and analyzer support for the parenthesized interval-qualified
datetime difference (for TIME and, consistently, DATE/TIMESTAMP), producing the
requested interval qualifier with documented rounding/truncation.
h2. Scope
Extend the SQL grammar and {{AstBuilder}} for the {{( <datetime> - <datetime> )
<interval qualifier>}} form; resolve to the appropriate subtraction expression
cast to the requested qualifier.
h2. Acceptance criteria
* {{(TIME '10:00:00' - TIME '08:00:00') HOUR}} returns an {{INTERVAL HOUR}}
value; other qualifiers behave per ANSI.
h2. Testing
Parser suite (e.g. {{ExpressionParserSuite}}) and {{TimeExpressionsSuite}};
golden files.
h2. Dependencies
None hard; largest/most speculative item in this set. Relates to the ANSI
OVERLAPS predicate sub-task (SPARK-57586).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]