You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by ๏̯͡๏ <ÐΞ€ρ@Ҝ>, de...@gmail.com on 2013/05/04 07:52:59 UTC

PigServer, load query fails, passes on grunt

PIG 0.11
Query :
I register the below string
String query = "A = LOAD '" + BENCHMARK_PARQUET_MR_DATA_TEXTINPUT + "'
using PigStorage() as (" + schemaString + ");";

with
pigServer.registerQuery(query);

It translates to

 A = LOAD '/home/deepakkv/benchmark/PIG/data/textinput' using PigStorage()
as (a0:chararray, a1:chararray, a2:chararray, a3:chararray, a4:chararray,
a5:chararray, a6:chararray, a7:chararray, a8:chararray, a9:chararray);


Exception
Caused by: Failed to parse: <line 1, column 357>  mismatched input 'AS'
expecting SEMI_COLON
    at
org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:235)
    at
org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:177)
    at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)


The very same query works in pig grunt shell.
-- 
Deepak

Re: PigServer, load query fails, passes on grunt

Posted by ๏̯͡๏ <ÐΞ€ρ@Ҝ>, de...@gmail.com.
Thanks Jonathan.
Figured that out.



On Sun, May 5, 2013 at 3:21 AM, Jonathan Coveney <jc...@gmail.com> wrote:

> Why do you have an "as" statement with the store? The schema should come
> down with the script. That's probably the issue.
>
>
> 2013/5/4 ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com>
>
> > Ignore above query. Its incorrect.
> >
> > I have following pig script
> > A = LOAD 'textinput' using PigStorage() as (a0:chararray, a1:chararray,
> > a2:chararray, a3:chararray, a4:chararray, a5:chararray, a6:chararray,
> > a7:chararray, a8:chararray,a9:chararray);
> > describe A;
> > store A into 'output2' using PigStorage();
> >
> > This works fine.
> >
> > However when i modify the store statement to
> > store A into 'output3' using PigStorage() as (a0:chararray, a1:chararray,
> > a2:chararray, a3:chararray, a4:chararray, a5:chararray, a6:chararray,
> > a7:chararray, a8:chararray,a9:chararray);
> >
> > It fails with below error
> > 2013-05-04 11:49:56,296 [main] ERROR org.apache.pig.tools.grunt.Grunt -
> > ERROR 1200: <line 9, column 42>  mismatched input 'as' expecting
> SEMI_COLON
> >
> >
> >
> > On Sat, May 4, 2013 at 11:22 AM, ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com>
> > wrote:
> >
> > > PIG 0.11
> > > Query :
> > > I register the below string
> > > String query = "A = LOAD '" + BENCHMARK_PARQUET_MR_DATA_TEXTINPUT + "'
> > > using PigStorage() as (" + schemaString + ");";
> > >
> > > with
> > > pigServer.registerQuery(query);
> > >
> > > It translates to
> > >
> > >  A = LOAD '/home/deepakkv/benchmark/PIG/data/textinput' using
> > PigStorage()
> > > as (a0:chararray, a1:chararray, a2:chararray, a3:chararray,
> a4:chararray,
> > > a5:chararray, a6:chararray, a7:chararray, a8:chararray, a9:chararray);
> > >
> > >
> > > Exception
> > > Caused by: Failed to parse: <line 1, column 357>  mismatched input 'AS'
> > > expecting SEMI_COLON
> > >     at
> > >
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:235)
> > >     at
> > >
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:177)
> > >     at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
> > >
> > >
> > > The very same query works in pig grunt shell.
> > > --
> > > Deepak
> > >
> > >
> >
> >
> > --
> > Deepak
> >
>



-- 
Deepak

Re: PigServer, load query fails, passes on grunt

Posted by Jonathan Coveney <jc...@gmail.com>.
Why do you have an "as" statement with the store? The schema should come
down with the script. That's probably the issue.


2013/5/4 ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com>

> Ignore above query. Its incorrect.
>
> I have following pig script
> A = LOAD 'textinput' using PigStorage() as (a0:chararray, a1:chararray,
> a2:chararray, a3:chararray, a4:chararray, a5:chararray, a6:chararray,
> a7:chararray, a8:chararray,a9:chararray);
> describe A;
> store A into 'output2' using PigStorage();
>
> This works fine.
>
> However when i modify the store statement to
> store A into 'output3' using PigStorage() as (a0:chararray, a1:chararray,
> a2:chararray, a3:chararray, a4:chararray, a5:chararray, a6:chararray,
> a7:chararray, a8:chararray,a9:chararray);
>
> It fails with below error
> 2013-05-04 11:49:56,296 [main] ERROR org.apache.pig.tools.grunt.Grunt -
> ERROR 1200: <line 9, column 42>  mismatched input 'as' expecting SEMI_COLON
>
>
>
> On Sat, May 4, 2013 at 11:22 AM, ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com>
> wrote:
>
> > PIG 0.11
> > Query :
> > I register the below string
> > String query = "A = LOAD '" + BENCHMARK_PARQUET_MR_DATA_TEXTINPUT + "'
> > using PigStorage() as (" + schemaString + ");";
> >
> > with
> > pigServer.registerQuery(query);
> >
> > It translates to
> >
> >  A = LOAD '/home/deepakkv/benchmark/PIG/data/textinput' using
> PigStorage()
> > as (a0:chararray, a1:chararray, a2:chararray, a3:chararray, a4:chararray,
> > a5:chararray, a6:chararray, a7:chararray, a8:chararray, a9:chararray);
> >
> >
> > Exception
> > Caused by: Failed to parse: <line 1, column 357>  mismatched input 'AS'
> > expecting SEMI_COLON
> >     at
> > org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:235)
> >     at
> > org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:177)
> >     at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
> >
> >
> > The very same query works in pig grunt shell.
> > --
> > Deepak
> >
> >
>
>
> --
> Deepak
>

Re: PigServer, load query fails, passes on grunt

Posted by ๏̯͡๏ <ÐΞ€ρ@Ҝ>, de...@gmail.com.
Ignore above query. Its incorrect.

I have following pig script
A = LOAD 'textinput' using PigStorage() as (a0:chararray, a1:chararray,
a2:chararray, a3:chararray, a4:chararray, a5:chararray, a6:chararray,
a7:chararray, a8:chararray,a9:chararray);
describe A;
store A into 'output2' using PigStorage();

This works fine.

However when i modify the store statement to
store A into 'output3' using PigStorage() as (a0:chararray, a1:chararray,
a2:chararray, a3:chararray, a4:chararray, a5:chararray, a6:chararray,
a7:chararray, a8:chararray,a9:chararray);

It fails with below error
2013-05-04 11:49:56,296 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 1200: <line 9, column 42>  mismatched input 'as' expecting SEMI_COLON



On Sat, May 4, 2013 at 11:22 AM, ÐΞ€ρ@Ҝ (๏̯͡๏) <de...@gmail.com> wrote:

> PIG 0.11
> Query :
> I register the below string
> String query = "A = LOAD '" + BENCHMARK_PARQUET_MR_DATA_TEXTINPUT + "'
> using PigStorage() as (" + schemaString + ");";
>
> with
> pigServer.registerQuery(query);
>
> It translates to
>
>  A = LOAD '/home/deepakkv/benchmark/PIG/data/textinput' using PigStorage()
> as (a0:chararray, a1:chararray, a2:chararray, a3:chararray, a4:chararray,
> a5:chararray, a6:chararray, a7:chararray, a8:chararray, a9:chararray);
>
>
> Exception
> Caused by: Failed to parse: <line 1, column 357>  mismatched input 'AS'
> expecting SEMI_COLON
>     at
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:235)
>     at
> org.apache.pig.parser.QueryParserDriver.parse(QueryParserDriver.java:177)
>     at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1599)
>
>
> The very same query works in pig grunt shell.
> --
> Deepak
>
>


-- 
Deepak