[
https://issues.apache.org/jira/browse/HIVE-23598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17124966#comment-17124966
]
Zoltan Haindrich commented on HIVE-23598:
-----------------------------------------
I think this could be rewritten to be use 'cume_dist' and let the other rewrite
do the heavy lifting...
{code}
select id,ntile(4) over (order by id),CEIL(cume_dist() over (order by id)*4)
from sketch_input
order by id;
{code}
the NTILE udf has an easy advantage: it may return different values for the
same input value.
{code}
select id,ntile(2) over (order by id) from TABLE(VALUES(1),(1),(1),(1)) AS
t(id);
+-----+-----------------+
| id | ntile_window_0 |
+-----+-----------------+
| 1 | 1 |
| 1 | 1 |
| 1 | 2 |
| 1 | 2 |
+-----+-----------------+
{code}
> Add option to rewrite NTILE to sketch functions
> -----------------------------------------------
>
> Key: HIVE-23598
> URL: https://issues.apache.org/jira/browse/HIVE-23598
> Project: Hive
> Issue Type: Sub-task
> Reporter: Zoltan Haindrich
> Assignee: Zoltan Haindrich
> Priority: Major
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)