Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Allow a type system to define its own time units and how they are rolled up.
Currently, time units are used in the EXTRACT, FLOOR, TRUNC functions, and include YEAR, QUARTER, MONTH, HOUR, MINUTE, NANOSECOND. For example FLOOR(t TO HOUR) is valid.
A type system would be allowed to define extra time units. Once a time unit is defined the EXTRACT, FLOOR and TRUNC functions should just work.
The definition of might consist of a base unit and multiplier. So MINUTE15 would be based on MINUTE with a multiplier of 15.
Various rules know that you can roll up FLOOR(t TO DAY) to FLOOR(t TO MONTH) but you cannot roll FLOOR(t TO WEEK) to FLOOR(t TO MONTH). When you define a new time unit, the type system can deduce that full set of time units that it can roll up to, and which can roll up to it.
Should we support time units that do not evenly divide the next largest time unit? For example the number of seconds since the top of the hour modulo 7. 60 and 3,600 are not a multiples of 7, so SecondOfHourMod7 would be different from SecondOfMinuteMod7.
Attachments
Issue Links
- blocks
-
CALCITE-5360 Implement TIMESTAMP_ADD function (compatible with BigQuery)
-
- Closed
-
- is duplicated by
-
CALCITE-5222 Support more EXTRACT field values (or allow arbitrary in parse?)
-
- Closed
-
- is related to
-
CALCITE-5369 In Avatica DateTimeUtils, add support for FLOOR and CEIL to ISOYEAR
-
- Closed
-
- relates to
-
CALCITE-5290 Add DATE_TRUNC function consistent with Postgres
-
- Open
-
-
CALCITE-5363 Move DATEADD, DATEDIFF, DATE_PART from Babel to Core parser
-
- Open
-
-
CALCITE-5364 In materialized view substitution, use custom time frames
-
- Open
-
-
CALCITE-5143 Allow custom time unit abbreviations in FLOOR, CEIL, EXTRACT, DATE_PART, DATEADD, DATEDIFF and similar functions
-
- Closed
-
-
CALCITE-5240 Enhance MaterializedViewRule so that it applies to rollup view for queries that contain a predicate on the rollup column
-
- Open
-
- links to