How can I add row numbers for rows in PIG or HIVE?

前端 未结 8 1899
半阙折子戏
半阙折子戏 2020-12-17 02:18

I have a problem when adding row numbers using Apache Pig. The problem is that I have a STR_ID column and I want to add a ROW_NUM column for the data in STR_ID, which is the

8条回答
  •  醉酒成梦
    2020-12-17 03:00

    In Hive:

    Query

    select str_id,row_number() over() from tabledata;
    

    Output

    3D64B18BC842      1
    BAECEFA8EFB6      2
    346B13E4E240      3
    6D8A9D0249B4      4
    9FD024AA52BA      5
    

提交回复
热议问题