clairvoyant
clairvoyant

Reputation: 129

pig latin force unique contraint

I need some help how to reach in pig that for a certain field only one record is taken.

A = load .... ;

/* data looks like:

transaction_id, prod_id, date

1, 123, 20140102

1, 124, 20140102

1, 125, 20140102

2, 233, 20140107

2, 245, 20140107

3, 255, 20140109 */

B = GROUP A BY transaction_id;

C = FOREACH B {
limited = LIMIT A 1;
GENERATE FLATTEN(limited);
};

i expect that it gives back 3 records, but only gives 1 record.

what i am doing wrong?

thanks for reply in advance.

Upvotes: 0

Views: 33

Answers (1)

clairvoyant
clairvoyant

Reputation: 129

i have found the problem. shame on me but i forget to change the field separator at load and thats why it only gave back one record

Upvotes: 1

Related Questions