首页 > 代码库 > hive 函数学习

hive 函数学习

NAME PRICE---- -----AAA  1.59AAA  2.00AAA  0.75BBB  3.48BBB  2.19BBB  0.99BBB  2.50

I would like to get target table:

RANK NAME PRICE---- ---- -----1    AAA  0.752    AAA  1.593    AAA  2.001    BBB  0.992    BBB  2.193    BBB  2.504    BBB  3.48

Normally I would use ROW_NUMBER() OVER function, so in Apache Hive it would be:

select  row_number() over (partition by NAME order by PRICE) as RANK,  NAME,  PRICEfrom  MY_TABLE;

hive 函数学习