Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
The standard specifies that RANGE-type frame bounds support date[time] arithmetics. That is, one can write queries like this:
SUM(number) OVER (PARTITION BY col1
|
ORDER BY date_col
|
RANGE BETWEEN INTERVAL 1 MONTH PRECEDING
|
AND INTERVAL 1 MONTH FOLLOWING)
|
MariaDB only supports numeric types there. The reason for the limitation is that interval is not a first-class datatype in MySQL codebase.
- Interval is not parsed to an Item object
- One cannot use addition/subtraction to add an interval to a date.
MDEV-9676uses Item_func_plus/Item_func_minus, which allow range bounds to use any numeric datatype. This doesn't include datetime, though.
The building blocks for date+interval arithmetics are already there:
SELECT DATE_ADD(date_col, INTERVAL 10 DAY)
|
SELECT DATE_SUB(date_col, INTERVAL 5 YEAR)
|
That is,
- the parser is able to parse interval values.
- there is code to do addition/subtraction.
This task is to support interval arithmetics in window functions.
Attachments
Issue Links
- blocks
-
MCOL-644 MariaDB 10.2 WF Add RANGE BETWEEN with date values
- Closed
- is part of
-
MDEV-6115 window functions as in the SQL standard
- Closed
-
MDEV-12987 complete window function support for columnstore parity
- Open
- relates to
-
MDEV-9676 RANGE-type frames for window functions
- Closed
-
MDEV-24937 window functions over unbounded RANGE fails on not numeric type
- Closed