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 Priority: Minor
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. - You can reply to this email to add a comment to the issue online.