[ 
https://issues.apache.org/jira/browse/DRILL-4933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15551000#comment-15551000
 ] 

Khurram Faraaz commented on DRILL-4933:
---------------------------------------

Works just fine for me, I am on 1.9.0

rownum without back quotes.
{noformat}
0: jdbc:drill:schema=dfs.tmp> select id, name, row_number() over(partition by 
state order by id) as rownum from `emp_tbl` limit 10;
+------+-------------+---------+
|  id  |    name     | rownum  |
+------+-------------+---------+
| 1    | John Doe    | 1       |
| 6    | Shawn Jay   | 2       |
| 29   | Alex        | 3       |
| 35   | Roger King  | 4       |
| 39   | Philip      | 5       |
| 800  | Susan       | 6       |
| 9    | Wright Bob  | 1       |
| 10   | Sharma      | 2       |
| 30   | Khan        | 3       |
| 100  | Kumar       | 4       |
+------+-------------+---------+
10 rows selected (0.195 seconds)
{noformat}

rownum within back quotes
{noformat}
0: jdbc:drill:schema=dfs.tmp> select id, name, row_number() over(partition by 
state order by id) as `rownum` from `emp_tbl` limit 10;
+------+-------------+---------+
|  id  |    name     | rownum  |
+------+-------------+---------+
| 1    | John Doe    | 1       |
| 6    | Shawn Jay   | 2       |
| 29   | Alex        | 3       |
| 35   | Roger King  | 4       |
| 39   | Philip      | 5       |
| 800  | Susan       | 6       |
| 9    | Wright Bob  | 1       |
| 10   | Sharma      | 2       |
| 30   | Khan        | 3       |
| 100  | Kumar       | 4       |
+------+-------------+---------+
10 rows selected (0.169 seconds)
{noformat}

> Column aliasing isn’t working when we use partition by clause with 
> row_number() [Ranking Window Functions]
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-4933
>                 URL: https://issues.apache.org/jira/browse/DRILL-4933
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>    Affects Versions: 1.8.0
>            Reporter: Deepak Shivamurthy
>            Priority: Minor
>
> I have run below query and alias is done on the third column, but still alias 
> does not working.
> select ID, sts_utc, row_number() over(partition by ID order by sts_utc) as 
> `rownum` from dfs.`/tmp/events` limit 10;
> Output:
> ID sts_utc, $2
> I would be expecting column rownum instead of $2.. (even i have other column 
> names, still aliasing didnt work)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to