Apache Drill - Window Function NTILE()



The NTILE window function requires the ORDER BY clause in the OVER clause.

Query

0: jdbc:drill:zk = local> select name,gender,ntile(3) over (order by gender) as
   row_partition from dfs.`/Users/../workspace/Drill-samples/student_list.json`;

Result

name   gender  row_partition
Esha   female       1
Ganga  female       1
Leena  female       1
Mary   female       1
Peter  female       2
Adam    male        2
Amit    male        2
Bob     male        3
David   male        3
Jack    male        3
apache_drill_window_functions_using_json.htm
Advertisements