Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
This is written in Calcite terms, a Calcite TIMESTAMP is a BigQuery DATETIME and a Calcite TIMESTAMP_LTZ is a BigQuery TIMESTAMP
The four BigQuery TRUNC functions: DATE_TRUNC, DATETIME_TRUNC, TIME_TRUNC, and TIMESTAMP_TRUNC have varying return types based on (1) which function and (2) the supplied datetime type. The return type can be inferred according to this chart:
FUNC/TYPE | DATE | TIMESTAMP | TIME | TS w/ LTZ |
DATE_TRUNC | DATE | TIMESTAMP | INVALID | TS w/ LTZ |
DATETIME_TRUNC | TIMESTAMP | TIMESTAMP | INVALID | TS w/ LTZ |
TIME_TRUNC | INVALID | INVALID | TIME | INVALID |
TIMESTAMP_TRUNC | TIMESTAMP | TIMESTAMP | INVALID | TS w/ LTZ |
The opened PR corrects the current implementations to match this chart, primarily by adjusting the set return types in the operator table, and also converting DATES to TIMESTAMPS in the convertlet table for the DATETIME_TRUNC and TIMESTAMP_TRUNC functions.
Attachments
Issue Links
- links to