Open xiangjinwu opened 1 year ago
table_or_source is required to be a simple name (table, source, mv, cte, view) rather than an arbitrary relation (subquery, join, table function).
I encounter a similar issue recently and I just workaround it via CREATE VIEW
Is it done?
Current status: The error message has been fixed. It guides the user to use CTE or view as workaround.
To improve user experience, we may support arbitrary expression at this place i.e. provide a syntax sugar rather than writing CTE. So keeping this issue open but at a later release.
Describe the bug
In a time window function like tumble or hop:
The current implementation requires
start_time
to be a column name rather than arbitrary expression. But the error message is misleading.To Reproduce
Current error message is:
Expected behavior
Pick one of the following:
start_time
, as long as it has correct return type.https://github.com/risingwavelabs/risingwave/blob/a061017590a291d2adf1531507fdc4d27d2ad44f/src/frontend/src/binder/relation/window_table_function.rs#L82-L92
Additional context
Note that we do have strict requirement of the 1st and 3rd argument:
table_or_source
is required to be a simple name (table, source, mv, cte, view) rather than an arbitrary relation (subquery, join, table function). It is challenging to support them in the parser. #2733window_size
(andhop_size
) is required to be a literal rather than arbitrary expression returning interval. It is practical and enables us to check validity in frontend. https://github.com/risingwavelabs/risingwave/issues/2469#issuecomment-1194115859Current workaround is to use with-cte syntax: