Apache Drill - Window Function Rank()



The ORDER BY expression in the OVER clause determines the value.

Query

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

Result

+--------+-----+--------------+
|  name  | age |  percentrank |
+--------+-----+--------------+
|  Adam  | 12  |       1      |
|  Amit  | 12  |       1      |
|  Bob   | 12  |       1      |
|  David | 12  |       1      |
|  Esha  | 12  |       1      |
|  Ganga | 12  |       1      |
|  Leena | 12  |       1      |
|  Jack  | 13  |       8      |
|  Mary  | 13  |       8      |
|  Peter | 13  |       8      |
+--------+-----+--------------+
apache_drill_window_functions_using_json.htm
Advertisements