[ 
https://issues.apache.org/jira/browse/PIG-671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003825#comment-13003825
 ] 

Deepak Kumar V commented on PIG-671:
------------------------------------

COUNT.exec() always retrieves the first item from input tuple which it assumes 
is a bag and counts the numbers of items in the bag. 
Even if we pass multiple arguments to COUNT(), it will always pick the first 
argument.

There are few ways we go through this
a) Leave as is cause it returns correct result for counting the number of items 
in the first argument.
OR
b) Make a check for the size of the input tuple in COUNT.exec() and if it is 
not 1 then throw ExecException()  or IllegalArgumentException {might be correct}
which will cause the Map job to fail.

Let me know how to we go about it.


> typechecker does not throw an error when multiple arguments are passed to 
> COUNT
> -------------------------------------------------------------------------------
>
>                 Key: PIG-671
>                 URL: https://issues.apache.org/jira/browse/PIG-671
>             Project: Pig
>          Issue Type: Bug
>         Environment: i686 i386 GNU/Linux
>            Reporter: Araceli Henley
>            Assignee: Thejas M Nair
>            Priority: Trivial
>
> In this example, the agggregate function COUNT is passed multiple arguments 
> and does not throw an error.
> TEST: Aggregate_184
>  A =LOAD '/user/pig/tests/data/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 ( A.$0, A.$0 ); 
> STORE X INTO 
> '/user/pig/tests/results/araceli.1234381533/AggregateFunc_184.out' USING 
> PigStorage();

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to