select count distinct using pig latin

前端 未结 3 1700
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-13 01:53

I need help with this pig script. I am just getting a single record. I am selecting 2 columns and doing a count(distinct) on another while also using a where like clause to find

3条回答
  •  走了就别回头了
    2021-02-13 02:33

    If you don't want to count on any group, you use this:

    G = FOREACH (GROUP A ALL){
    unique = DISTINCT A.field;
    GENERATE COUNT(unique) AS ct;
    };
    

    This will just give you a number.

提交回复
热议问题