[
https://issues.apache.org/jira/browse/CALCITE-7485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18075398#comment-18075398
]
Yu Xu edited comment on CALCITE-7485 at 4/22/26 9:26 AM:
---------------------------------------------------------
Yes, I checked the tests and confirmed that this is indeed the case. For
example, the syntax tree in Postgre for `last_value` looks like this:
{code:java}
LAST_VALUE ( expression ) OVER (
[PARTITION BY partition_expression, ... ]
ORDER BY sort_expression [ASC | DESC], ...
[ frame_clause ]
) {code}
The documentation also indicates: *these functions _must_ be invoked using
window function syntax, i.e., an {{OVER}} clause is required.*
we also can refer:
[https://www.postgresql.org/docs/18/functions-window.html]
was (Author: JIRAUSER307770):
Yes, I checked the tests and confirmed that this is indeed the case. For
example, the syntax tree in Postgre for `last_value` looks like this:
{code:java}
LAST_VALUE ( expression ) OVER (
[PARTITION BY partition_expression, ... ]
ORDER BY sort_expression [ASC | DESC], ...
[ frame_clause ]
) {code}
The documentation also indicates: *these functions _must_ be invoked using
window function syntax, i.e., an {{OVER}} clause is required.*
we also can refer:
[https://www.postgresql.org/docs/18/functions-window.html]
https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS
> FIRST_VALUE/LAST_VALUE should only be defined for window aggregates
> -------------------------------------------------------------------
>
> Key: CALCITE-7485
> URL: https://issues.apache.org/jira/browse/CALCITE-7485
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.41.0
> Reporter: Yu Xu
> Priority: Major
>
> FIRST_VALUE and LAST_VALUE are only defined for window aggregates, but can be
> used without window clause in current main branch.
> test case would be passed as follow:
>
> {code:java}
> @Test void testFirstAndLastAggFunctionsOfGroupByKeys() {
> final String sql = "select sal, first_value(sal) as sal_first,
> last_value(sal) as sal_last from emp group by sal, deptno\n";
> sql(sql).check();
> } {code}
> maybe we should fix the issue.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)