I have a table with an identifier column id
and another column with string values column_b
for which I would like to do customer ordering on column_b
. Let's say that column_b
consists of values A, B, C, D.
The syntax that can be used in Hive for row_number() over() is:
SELECT id, column_b, row_number() over(partition by id order by column_b) as row_id
FROM some_table
Example see here for an example
However, I would like to do custom ordering on column_b
instead of alphabetic ordering. The above syntax would yield something like:
Instead, I would like to explicitly order by column_b using the order A, C, D, B
, that is:
How can I achieve this?