[
https://issues.apache.org/jira/browse/CALCITE-5955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767667#comment-17767667
]
Julian Hyde commented on CALCITE-5955:
--------------------------------------
I see that {{allowsFraming}} is already defined in {{SqlOperator}}. Adding it
to {{SqlBasicAggFunction}} makes sense. Maybe it would even allow us to
obsolete {{SqlLeadLagAggFunction}} and {{SqlRankFunction}}.
i am worried that we are on a path to treating {{PERCENTILE_CONT2}} (our
version of percentile for BQ) as it if really is a window function. I prefer to
think of it as percentile aggregate function that happens to use {{OVER}} as
its syntax. Would it be sufficient to change the unparse function, and treat
functions with {{isPercentile() = true}} differently when the target dialect is
BQ?
> 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)