[ 
https://issues.apache.org/jira/browse/CALCITE-5955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17768926#comment-17768926
 ] 

Oliver Lee commented on CALCITE-5955:
-------------------------------------

I'm trying to catch up on the current development and PR for this Jira ticket.

After reading the BQ docs on window functions, I do have to say that what 
BigQuery syntax shows is deceivingly similar to what a "window function" is. 
The docs point `percentile_cont` to window functions and meets what the window 
function documentation defines as the requirement for being a window function. 

It says 
{quote}{{PERCENTILE_CONT (value_expression, percentile [{RESPECT | IGNORE} 
NULLS])
OVER over_clause}}

{{}}

To learn more about the {{OVER}} clause and how to use it, see [Window function 
calls|https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls].

{{...-> A window function includes an {{OVER}} clause }}
{quote}
 

Going off of this Oracle diagram [here 
|https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/PERCENTILE_CONT.html#GUID-CA259452-A565-41B3-A4F4-DD74B66CEDE0]I
 can also see Julians point about it not being a window function, it just 
happens to swap out the words {{WITHIN GROUP}} with {{OVER}} 

 

> 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)

Reply via email to