You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org> on 2011/09/16 20:43:08 UTC
[jira] [Commented] (PIG-2290) TOBAG wraps tuple parameters in
another tuple
[ https://issues.apache.org/jira/browse/PIG-2290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13106676#comment-13106676 ]
Dmitriy V. Ryaboy commented on PIG-2290:
----------------------------------------
Looks good, though the formatting is a little off:
{code}
+ } else {
Tuple tp2 = TupleFactory.getInstance().newTuple(1);
tp2.set(0, object);
bag.add(tp2);
}
+ }
{code}
The else block is not indented properly.
Ok to put in trunk or do you feel this must go into 0.9.1?
> TOBAG wraps tuple parameters in another tuple
> ---------------------------------------------
>
> Key: PIG-2290
> URL: https://issues.apache.org/jira/browse/PIG-2290
> Project: Pig
> Issue Type: Bug
> Components: internal-udfs
> Affects Versions: 0.9.0
> Reporter: Ryan Hoegg
> Attachments: pig-2290.patch
>
>
> The TOBAG function indiscriminately wraps all parameters in a tuple. When I pass a list of tuples to the function, I would expect it to return a bag containing those tuples. Instead, it returns a bag containing single element tuples, where each tuple contains one of the tuples passed in.
> Example:
> {code:title=tuples.txt}
> (mike,608)
> (ryan,11624)
> (justin,2317)
> {code}
> {code:title=Demonstration using pig 0.9.0}
> grunt> TUPLE_DATA = LOAD 'tuples.txt' AS (T:tuple(name:chararray,street_number:int));
> grunt> BAGGED = FOREACH TUPLE_DATA GENERATE TOBAG(T);
> grunt> DESCRIBE BAGGED;
> BAGGED: {{(name: chararray,street_number: int)}}
> grunt> DUMP BAGGED;
> ({((mike,608))})
> ({((ryan,11624))})
> ({((justin,2317))})
> {code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira