You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Colleen Ross <cc...@gmail.com> on 2012/03/10 03:19:29 UTC

how to set one var equal to another

I tried to subscribe but a mail client box came up, not what I wanted, so
we'll see if this works.

I wrote this script:

register s3n://uw-cse344-code/myudfs.jar


-- load the test file into Pig
--raw = LOAD 's3n://uw-cse344-test/cse344-test-file' USING TextLoader as
(line:chararray);
-- later you will load to other files, example:
raw = LOAD 's3n://uw-cse344/btc-2010-chunk-000' USING TextLoader as
(line:chararray);

-- parse each line into ntriples
ntriples = foreach raw generate FLATTEN(myudfs.RDFSplit3(line)) as
(subject:chararray,predicate:chararray,object:chararray);

--filter 1
subjects1 = filter ntriples by subject matches '.*rdfabout\\.com.*'
PARALLEL 50;
--filter 2
subjects2 = subjects1;

but I got the error:
2012-03-10 01:19:18,039 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 1200: <line 4, column 21>  mismatched input ';' expecting LEFT_PAREN
Details at logfile: /home/hadoop/pig_1331342327467.log

how do I simply set one variable equal to another?

I also tried subjects2 = dump subjects1;

thanks!


-- 
~Colleen Ross

Re: how to set one var equal to another

Posted by Aniket Mokashi <an...@gmail.com>.
Hi Colleen,

I'm not sure whats your use case, but you may want to watch
https://issues.apache.org/jira/browse/PIG-438.

Thanks,
Aniket


On Sat, Mar 10, 2012 at 11:33 AM, Jonathan Coveney <jc...@gmail.com>wrote:

> It's important to remember that the aliases to the left of the equals are
> not variables, per se, they represent relations, which is basically a bunch
> of data. You can achieve what you want by doing:
>
> subjects2 = foreach subjects1 generate *;
>
> As far as doing something like:
>
> subjects 2 = dump subject1;
>
> dump, store, etc do not generate relations, they are what generate M/R
> jobs.
>
> It can all be pretty opaque. Post if you have more questions.
> Jon
>
> 2012/3/9 Colleen Ross <cc...@gmail.com>
>
> > I tried to subscribe but a mail client box came up, not what I wanted, so
> > we'll see if this works.
> >
> > I wrote this script:
> >
> > register s3n://uw-cse344-code/myudfs.jar
> >
> >
> > -- load the test file into Pig
> > --raw = LOAD 's3n://uw-cse344-test/cse344-test-file' USING TextLoader as
> > (line:chararray);
> > -- later you will load to other files, example:
> > raw = LOAD 's3n://uw-cse344/btc-2010-chunk-000' USING TextLoader as
> > (line:chararray);
> >
> > -- parse each line into ntriples
> > ntriples = foreach raw generate FLATTEN(myudfs.RDFSplit3(line)) as
> > (subject:chararray,predicate:chararray,object:chararray);
> >
> > --filter 1
> > subjects1 = filter ntriples by subject matches '.*rdfabout\\.com.*'
> > PARALLEL 50;
> > --filter 2
> > subjects2 = subjects1;
> >
> > but I got the error:
> > 2012-03-10 01:19:18,039 [main] ERROR org.apache.pig.tools.grunt.Grunt -
> > ERROR 1200: <line 4, column 21>  mismatched input ';' expecting
> LEFT_PAREN
> > Details at logfile: /home/hadoop/pig_1331342327467.log
> >
> > how do I simply set one variable equal to another?
> >
> > I also tried subjects2 = dump subjects1;
> >
> > thanks!
> >
> >
> > --
> > ~Colleen Ross
> >
>



-- 
"...:::Aniket:::... Quetzalco@tl"

Re: how to set one var equal to another

Posted by Jonathan Coveney <jc...@gmail.com>.
It's important to remember that the aliases to the left of the equals are
not variables, per se, they represent relations, which is basically a bunch
of data. You can achieve what you want by doing:

subjects2 = foreach subjects1 generate *;

As far as doing something like:

subjects 2 = dump subject1;

dump, store, etc do not generate relations, they are what generate M/R jobs.

It can all be pretty opaque. Post if you have more questions.
Jon

2012/3/9 Colleen Ross <cc...@gmail.com>

> I tried to subscribe but a mail client box came up, not what I wanted, so
> we'll see if this works.
>
> I wrote this script:
>
> register s3n://uw-cse344-code/myudfs.jar
>
>
> -- load the test file into Pig
> --raw = LOAD 's3n://uw-cse344-test/cse344-test-file' USING TextLoader as
> (line:chararray);
> -- later you will load to other files, example:
> raw = LOAD 's3n://uw-cse344/btc-2010-chunk-000' USING TextLoader as
> (line:chararray);
>
> -- parse each line into ntriples
> ntriples = foreach raw generate FLATTEN(myudfs.RDFSplit3(line)) as
> (subject:chararray,predicate:chararray,object:chararray);
>
> --filter 1
> subjects1 = filter ntriples by subject matches '.*rdfabout\\.com.*'
> PARALLEL 50;
> --filter 2
> subjects2 = subjects1;
>
> but I got the error:
> 2012-03-10 01:19:18,039 [main] ERROR org.apache.pig.tools.grunt.Grunt -
> ERROR 1200: <line 4, column 21>  mismatched input ';' expecting LEFT_PAREN
> Details at logfile: /home/hadoop/pig_1331342327467.log
>
> how do I simply set one variable equal to another?
>
> I also tried subjects2 = dump subjects1;
>
> thanks!
>
>
> --
> ~Colleen Ross
>