MinJi Kim commented on CALCITE-1931:

I think CUME_DIST() and PERCENT_RANK() for example, should return floating 
point, since generally their return values are less than or equal to 1 (I 
looked at Oracle and MS SqlServer, and they both return fractional values and 1 
for these functions).  I changed the other functions (e.g. 
NTILE/RANK/DENSE_RANK) to return BIGINT rather than INT.  For example, MS 
SqlServer returns BIGINT for NTILE/RANK/DENSE_RANK functions.

I didn't think they were controversial since I don't think CUME_DIST() should 
return integers, otherwise all the values would be zero.  But perhaps somebody 
is using that behavior somewhere.  I can definitely add a way for users to 
specify return values of RANK functions as in CALCITE-845.  I would probably 
just allow two policies, one for CUME_DIST/PERCENT_RANK and another for 
NTILE/RANK/DENSE_RANK (with the default being the new behavior as in this 
patch).  Do you think that makes sense?

> rank/ntile/etc. functions should not always return INTEGER
> ----------------------------------------------------------
>                 Key: CALCITE-1931
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1931
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: MinJi Kim
>            Assignee: Julian Hyde
> For example, rank() and percent_rank() both return INTEGER.  For rank(), it 
> would be better to return BIGINT; for percent_rank(), we should actually 
> return double or float since it is a percent value.  There are other rank 
> functions that should return floating number instead of integer.

This message was sent by Atlassian JIRA

Reply via email to