You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Xuefu Zhang (JIRA)" <ji...@apache.org> on 2011/04/14 19:23:05 UTC
[jira] [Commented] (PIG-674) Improve errors in Pig parser
[ https://issues.apache.org/jira/browse/PIG-674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019923#comment-13019923 ]
Xuefu Zhang commented on PIG-674:
---------------------------------
tried all the cases above, Pig now is giving much better error messages. For example, for the first test case above, this is what Pig emits:
grunt> X =FOREACH B GENERATE A.Fint, MAX( (invalid) A.Fint );
2011-04-14 10:18:57,513 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 6, column 33> Syntax error, unexpected symbol at or near '('
For the last test case:
grunt> X = FOREACH B GENERATE AVG( A.Ftuple );
2011-04-14 10:09:30,633 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1045: <line 5, column 23> Could not infer the matching function for org.apache.pig.builtin.AVG as multiple or none of them fit. Please use an explicit cast.
Thus, case is closed.
> Improve errors in Pig parser
> ----------------------------
>
> Key: PIG-674
> URL: https://issues.apache.org/jira/browse/PIG-674
> Project: Pig
> Issue Type: Bug
> Reporter: Araceli Henley
> Assignee: Xuefu Zhang
> Priority: Minor
> Fix For: 0.9.0
>
>
> These tests are for Aggregate Functions
> ################################################################
> Recomend msg - SHould indicate that this is an invalid cast.
> ERROR - MAX with int with invalid cast
> TEST: 106,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE A.Fint, MAX( (invalid) A.Fint ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1000:.*Invalid alias: MAX",
> ################################################################
> Recomend msg - SHould indicate that this is an invalid cast.
> ERROR - MAX with int with invalid cast
> TEST: 106,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE A.Fint, MAX( (invalid) A.Fint ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1000:.*Invalid alias: MAX",
> ################################################################
> Recomend msg -
> ERROR: invalid use of foreach with multiple functions and positional parameters
> TEST: 107,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH A GENERATE SUM( A.$0), AVG( A.$0), COUNT( A.$0), MAX(A.$0), MIN( A.$0); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "FIX: improve msg",
> ################################################################
> Recomend msg - ERROR 1052: Cannot cast bag with schema.*: bag
> ERROR: invalid use of MIN with int with valid cast
> TEST: 108,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE A.Fint, MIN( (double) A.Fint ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1052: Cannot cast.*",
> ################################################################
> Recomend msg -
> ERROR - AVG needs bag
> TEST: 113,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) ); B = GROUP A ALL; X =FOREACH B GENERATE AVG( A.Fint); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1052: Cannot cast bag with schema.*bag",
> ################################################################
> Recomend msg - this should indicate there was an invalid Cast
> ERROR - AVG with int with invalid cast
> TEST: 115,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE A.Fint, AVG( (invalid) A.Fint ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1000:.*Invalid alias: AVG",
> ################################################################
> Recomend msg - this should indicate that COUNT expects a bag for an argument
> ERROR - COUNT needs bag
> TEST: 118,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) ); B = GROUP A ALL; X =FOREACH B GENERATE COUNT( Fint); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1000:.*Invalid alias: COUNT",
> ################################################################
> Recomend msg - missing parenthesis while parsing MAX.",
> ERROR - MAX without parenthesis
> TEST: 133,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE MAX A.$0; STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1000:.*MAX",
> ################################################################
> ERROR - SUM with missing argument
> TEST: 161,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE SUM(); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 2064: Unsupported root type in LOForEach: LOUserFunc",
> ################################################################
> Recomend msg -
> ERROR - SUM with invalid number of parameters
> TEST: 162,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE SUM ( A.$0, A.$0 ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1045:.*SUM",
> ################################################################
> Recomend msg -
> ERROR - SUM with incompatible datatype
> TEST: 163,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE SUM ( A.Fbag ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "FIX: Improve error message. Currently ERROR: 1045",
> ################################################################
> Recomend msg - invalid use of SUM
> ERROR: invalid use of foreach with multiple functions and positional parameters
> TEST: 107,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH A GENERATE SUM( A.$0), AVG( A.$0), COUNT( A.$0), MAX(A.$0), MIN( A.$0); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: " ERROR 1000: Error during parsing. Invalid alias: A",
> ################################################################
> Recomend msg - Incompatible type in argument to MAX
> ERROR - MAX with incompatible type
> TEST: 143,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) ); B = GROUP A ALL; X= FOREACH B GENERATE MAX( A.Ftuple ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: " ERROR 1045: Could not infer the matching function",
> ################################################################
> Recomend msg - Missing parenthesis in MIN
> ERROR - MIN without parenthesis
> TEST: 144,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE MIN A.$0; STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1000:.*Invalid alias: MIN",
> ################################################################
> Recomend msg -
> ERROR - SUM with incompatible cast
> TEST: 164,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE SUM ( (chararray) Fint, Fint ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1000: Error during parsing. Invalid alias: Fint",
> ################################################################
> Recomend msg -
> ERROR - AVG with incompatible cast
> TEST: 175,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) );B =GROUP A ALL; X =FOREACH B GENERATE AVG ( (chararray) Fint ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: "ERROR 1045:.*AVG",
> ################################################################
> Recomend msg - Incompatible type in argument for AVG
> ERROR - AVG with incompatible type
> TEST: 177,
> PIG SCRIPT: A =LOAD ':INPATH:/types/DataAll' USING PigStorage() AS ( Fint:int, Flong:long, Fdouble:double, Ffloat:float, Fchar:chararray, Fchararray:chararray, Fbytearray:bytearray, Fmap:map[], Fbag:BAG{ t:tuple( name, age, avg ) }, Ftuple:( name:chararray, age:int, avg:float) ); B = GROUP A ALL; X = FOREACH B GENERATE AVG( A.Ftuple ); STORE X INTO ':OUTPATH:' USING PigStorage();\,
> CURRENT ERROR MESSAGE: " ERROR 1045:.*AVG",
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira