Apache Drill - Window Function Percent_rank



The following program shows the query for this function −

Query

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

Result

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