I have a relation, reflat1. Below are the output of DESCRIBE and DUMP.
reflat1: {cookie: chararray,tupofstuff: (category: chararray,weight: double,lasttime: long)}
(key1,(613,1.0,1410155702)
(key2,(iOS,1.0,1410155702)
(key3,(G.M.,1.0,1410155702)
Yes, I notice that the parentheses do not get closed. I have no clue why. Perhaps the reason there are no parentheses is the source of all of my problems.
I want to transform it to a relation (let's call it reflat2) with 4 fields, which would ideally look like:
(key1, 613, 1.0,1410155702)
(key2, iOS, 1.0,1410155702)
(key3, G.M., 1.0,1410155702)
But my code is NOT working. Below is the relevant bit.
reflat2 = foreach reflat1 {
GENERATE
cookie as cookie,
tupofstuff.(category) as category,
tupofstuff.(weight) as weight,
tupofstuff.(lasttime) as lasttime;
};
r1 = LIMIT reflat2 100;
dump r1;
Which leads to the schema I'd expect:
DESCRIBE reflat2
reflat2: {cookie: chararray,category: chararray,weight: double,lasttime: long}
But gives an error on the dump:
Unable to open iterator for alias r1
When I look at the errors on the failed MapReduce jobs, I see:
java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.pig.data.Tuple
Which is weird, because if anything I'm casting a tuple to a string (and a double and a long), not vice versa.