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
You could GROUP on each domain and then count the number of distinct elements in each group with a nested FOREACH syntax:
D = group C by domain; E = foreach D { unique_segments = DISTINCT C.segment; generate group, COUNT(unique_segments) as segment_cnt; };