Great! This will work for me Dan. I will say though, that for a large nested structure, it would be very much simpler if the aliases could be assigned inline.
Thanks, Allan ----- Original Message ----- From: "Dan DeCapria, CivicScience" <[email protected]> To: [email protected] Sent: Wednesday, April 9, 2014 8:57:56 AM Subject: Re: Is it possible to give an alias to a CONCAT nested in a TOTUPLE? Consider typing the schema at the tuple level: data2 = FOREACH data GENERATE TOTUPLE(CONCAT(f1, f2), f3) AS my_new_tuple:tuple(field_that_needs_a_name:chararray, f3); Hope this helps, -Dan On Tue, Apr 8, 2014 at 9:05 PM, Allan Ortiz <[email protected]> wrote: > Sorry, I should have also specified the error that I was receiving: > > ---------------- > grunt> data2 = FOREACH data GENERATE > >> TOTUPLE( > >> CONCAT(f1, f2) AS field_that_needs_a_name, > >> f3); > 2014-04-08 17:49:27,946 [main] ERROR org.apache.pig.tools.grunt.Grunt - > ERROR 1200: <line 14, column 9> mismatched input '(' expecting SEMI_COLON > Details at logfile: /home/oldman/pig_1397004393407.log > ---------------- > > Thanks! > ----- Original Message ----- > > From: "Allan Ortiz" <[email protected]> > To: [email protected] > Sent: Tuesday, April 8, 2014 5:55:47 PM > Subject: Is it possible to give an alias to a CONCAT nested in a TOTUPLE? > > I am using pig 0.11.1. > > Example: > --------------- > data: > a,b,c > > data = LOAD 'data' USING PigStorage(',') AS (f1:chararray, f2:chararray, > f3:chararray); > > data2 = FOREACH data GENERATE > TOTUPLE( > CONCAT(f1, f2), > f3); > ---------------- > > The above works fine, but if I change the last statement to name the > result of the CONCAT as so: > ------------------ > data2 = FOREACH data GENERATE > TOTUPLE( > CONCAT(f1, f2) AS field_that_needs_an_alias, > f3); > ----------------- > It doesn't work for me. Am I doing things right? If so, is this a bug, or > should I make a feature request? I have ran into this problem a couple of > times now. > > Thanks, > Allan > >
