PIG how to count a number of rows in alias

前端 未结 7 1839
盖世英雄少女心
盖世英雄少女心 2020-12-07 11:03

I did something like this to count the number of rows in an alias in PIG:

logs = LOAD \'log\'
logs_w_one = foreach logs generate 1 as one;
logs_group = group         


        
7条回答
  •  春和景丽
    2020-12-07 11:56

    Arnon Rotem-Gal-Oz already answered this question a while ago, but I thought some may like this slightly more concise version.

    LOGS = LOAD 'log';
    LOG_COUNT = FOREACH (GROUP LOGS ALL) GENERATE COUNT(LOGS);
    

提交回复
热议问题