user3712659
user3712659

Reputation: 1

how to pass data to pig relations

Please let me know if we can load a particular field of relation into another as shown below

usergroup = GROUP input BY user;

output = FOREACH usergroup {
                intermediate = input.traid;
                distinctdata = DISTINCT intermediate;

        GENERATE group as user,count(distinctdata); };

Upvotes: 0

Views: 32

Answers (1)

Alen
Alen

Reputation: 174

You can't load a particular field of relation into another.

Per my understanding you want to distinct values for input.traid and then count it.

Here you would always get 1 for count(distinctdata) for every user. Why would you want this as output?

DISTINCT does not work on specific columns (fields), but is used for tuples (row).

It removes duplicate tuples.

Upvotes: 1

Related Questions