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

Julian Hyde commented on CALCITE-4644:
--------------------------------------

I agree with [~liyafan]'s remark (in PR review) that {{isPercentile}} seems too 
narrow. However I can't think of a better name right now. I propose that you 
mark the {{isPercentile}} method experimental. This will allow us to refactor 
it later.

{{PERCENTILE_DISC}} should allow any type in the {{ORDER BY}} clause, not just 
numeric. (PostgreSQL and MSSQL doc agree with this.) I wonder whether we should 
allow an {{ORDER BY}} with any number of keys (not just one). Because we don't 
need to find the difference between keys.

You are checking that the {{ORDER BY}} of {{PERCENTILE_CONT}} is numeric, and 
that agrees with PostgreSQL and MSSQL. However, I claim that we should also 
allow datetime and interval values. Why? Because the difference between two of 
these values is numeric. (An interval is basically a number.)

(Note that in {{OVER}}, you can specify {{RANGE}} if and only if the type of 
the {{ORDER BY}} key is numeric, interval or datetime, for the same reasons. 
Maybe you could re-use the validation logic and error message of {{RANGE}}.)

> Add PERCENTILE_CONT and PERCENTILE_DISC aggregate functions
> -----------------------------------------------------------
>
>                 Key: CALCITE-4644
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4644
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Rafay A
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> Add percentile functions in the operator table.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to