This is an automated email from the ASF dual-hosted git repository. mbudiu pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push: new f672d39dc8 [CALCITE-6442] Validator rejects FILTER in OVER windows f672d39dc8 is described below commit f672d39dc8ef1b7b72ae282bc4b319e026e3f5e6 Author: Mihai Budiu <mbu...@feldera.com> AuthorDate: Mon Jun 24 13:57:38 2024 -0700 [CALCITE-6442] Validator rejects FILTER in OVER windows Signed-off-by: Mihai Budiu <mbu...@feldera.com> --- .../test/java/org/apache/calcite/test/SqlValidatorTest.java | 11 +++++++++++ site/_docs/reference.md | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java b/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java index ea61907ee8..bb4dc7b783 100644 --- a/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java +++ b/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java @@ -2891,6 +2891,17 @@ public class SqlValidatorTest extends SqlValidatorTestCase { .fails("PARTITION BY expression should not contain OVER clause"); } + /** Test case for <a href="https://issues.apache.org/jira/browse/CALCITE-6442">[CALCITE-6442] + * Validator rejects FILTER in OVER windows</a>. */ + @Test void testOverFilter() { + winSql("SELECT deptno,\n" + + " ^COUNT(DISTINCT deptno) FILTER (WHERE deptno > 10)^\n" + + "OVER win AS agg\n" + + "FROM emp\n" + + "WINDOW win AS (PARTITION BY empno)") + .fails("OVER must be applied to aggregate function"); + } + @Test void testOverInOrderBy() { winSql("select sum(deptno) over ^(order by sum(deptno)\n" + "over(order by deptno))^ from emp") diff --git a/site/_docs/reference.md b/site/_docs/reference.md index 5e018480fb..2b7777d790 100644 --- a/site/_docs/reference.md +++ b/site/_docs/reference.md @@ -1969,10 +1969,8 @@ windowedAggregateCall: agg '(' [ ALL | DISTINCT ] value [, value ]* ')' [ RESPECT NULLS | IGNORE NULLS ] [ WITHIN GROUP '(' ORDER BY orderItem [, orderItem ]* ')' ] - [ FILTER '(' WHERE condition ')' ] OVER window | agg '(' '*' ')' - [ FILTER '(' WHERE condition ')' ] OVER window {% endhighlight %}