[ https://issues.apache.org/jira/browse/CALCITE-5955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17772318#comment-17772318 ]
Oliver Lee commented on CALCITE-5955: ------------------------------------- [~julianhyde] , I was thinking that the parser would have to change because the current state is that {{OVER}} is parsed into the {{SqlOverOperator}} and many of what {{SqlOverOperator}} is based on is now no longer applicable. It is validation that throws the error and not the parser, but it would be pretty hairy to untangle that because there are many asserts that happen: For example 1) SqlOverOperator [has an assert |https://github.com/apache/calcite/blob/ab3f5b0e800b2166f130fa75fc3a67f6961b5082/core/src/main/java/org/apache/calcite/sql/SqlOverOperator.java#L76] 2) validateWindow will call a [setWindow that has an assert|https://github.com/apache/calcite/blob/ab3f5b0e800b2166f130fa75fc3a67f6961b5082/core/src/main/java/org/apache/calcite/sql/SqlWindow.java#L303] 3) subsequent casts to [SqlAggFunction that fail|https://github.com/apache/calcite/blob/ab3f5b0e800b2166f130fa75fc3a67f6961b5082/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L6124] > BigQuery PERCENTILE functions are unparsed incorrectly > ------------------------------------------------------ > > Key: CALCITE-5955 > URL: https://issues.apache.org/jira/browse/CALCITE-5955 > Project: Calcite > Issue Type: Bug > Reporter: Tanner Clary > Assignee: Tanner Clary > Priority: Major > Labels: pull-request-available > > Currently if you have a query like: > {{SELECT PERCENTILE_CONT(x, .5) OVER() FROM x;}} the {{OVER()}} clause gets > unparsed with a {{window frame clause}} which BigQuery defines > [here|https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls#def_window_frame]. > > From the docs: "Only aggregate analytic functions can use a window frame > clause." > This causes BigQuery to fail with the following error: {{Window framing > clause is not allowed for analytic function percentile_cont}} -- This message was sent by Atlassian Jira (v8.20.10#820010)