Zhen Chen created CALCITE-7590:
----------------------------------
Summary: Improve error message for window functions missing OVER
clause to include function name
Key: CALCITE-7590
URL: https://issues.apache.org/jira/browse/CALCITE-7590
Project: Calcite
Issue Type: Improvement
Affects Versions: 1.42.0
Reporter: Zhen Chen
Fix For: 1.43.0
Currently, when a window function is used without an OVER clause, Calcite
reports a generic error message:
"OVER clause is necessary for window functions"
This message doesn't tell users which function is missing the OVER clause,
which can be confusing when a query contains multiple window functions or when
the error occurs in complex queries.
Example query:
SELECT rank(), row_number() OVER (ORDER BY id) FROM emp
Current error message:
"OVER clause is necessary for window functions"
This change improves the error message to include the function name:
"window function RANK requires an OVER clause"
This makes it immediately clear which function needs to be fixed and it behaves
consistently with PostgreSQL, improving the developer experience and reducing
debugging time.
Changes:
- Added new resource message: absentOverClauseWithFunctionName
- Updated SqlAggFunction and SqlValidatorImpl to use the new message format
- Updated all related tests in SqlValidatorTest
--
This message was sent by Atlassian Jira
(v8.20.10#820010)