提交 bcdfb4a8 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Disallow window ordering clause for RATIO_TO_REPORT

上级 ab3f0cd8
......@@ -5559,7 +5559,7 @@ OVER windowNameOrSpecification
","
Returns the ratio of a value to the sum of all values.
If argument is NULL or sum of all values is 0, then the value of function is NULL.
Window frame clause is not allowed for this function.
Window ordering and window frame clauses are not allowed for this function.
Window functions are currently experimental in H2 and should be used with caution.
They also may require a lot of memory for large queries.
......
......@@ -451,6 +451,9 @@ public class WindowFunction extends DataAnalysisOperation {
throw DbException.getSyntaxError(sql, sql.length() - 1, "ORDER BY");
default:
}
} else if (type == WindowFunctionType.RATIO_TO_REPORT) {
String sql = getSQL();
throw DbException.getSyntaxError(sql, sql.length() - 1);
}
super.optimize(session);
if (args != null) {
......
......@@ -31,5 +31,8 @@ SELECT ID, N, RATIO_TO_REPORT(N) OVER() R2R FROM TEST;
> 5 -8 null
> rows: 5
SELECT RATIO_TO_REPORT(N) OVER (ORDER BY N) FROM TEST;
> exception SYNTAX_ERROR_1
DROP TABLE TEST;
> ok
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论