Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Syntax error while parsing the DATEADD function:
SELECT DATE(CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', events.event_date )) AS "events.event_date", COALESCE(SUM(events.daily_user_count ), 0) AS "events.daily_active_users", COALESCE(SUM(events.monthly_user_count ), 0) AS "events.monthly_active_users" FROM public.events_proto AS events WHERE (((events.event_date ) >= ((CONVERT_TIMEZONE('America/Los_Angeles', 'UTC', DATEADD(day,-364, DATE_TRUNC('day',CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', GETDATE())) )))) AND (events.event_date ) < ((CONVERT_TIMEZONE('America/Los_Angeles', 'UTC', DATEADD(day,365, DATEADD(day,-364, DATE_TRUNC('day',CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', GETDATE())) ) )))))) GROUP BY 1 HAVING NOT (COALESCE(SUM(events.monthly_user_count ), 0) = 0) ORDER BY 1 DESC LIMIT 500
throwsÂ
`Column 'year' not found in any table` `DATEADD(year,1,...`
This query is valid on Redshift. Redshift's parser understands that the first argument (DAY) is intended to be a time unit, not an identifier.
Attachments
Issue Links
- relates to
-
CALCITE-5135 Planner#parse can't parse DAY() function
- Open
-
CALCITE-5180 Implement BigQuery functions for DATE, TIME, TIMESTAMP, DATETIME
- Open
-
CALCITE-5143 Allow custom time unit abbreviations in FLOOR, CEIL, EXTRACT, DATE_PART, DATEADD, DATEDIFF and similar functions
- Closed
-
CALCITE-6410 dateadd(MONTH, 3, date '2016-02-24') parsing failed
- Closed
- links to