[
https://issues.apache.org/jira/browse/PIG-2267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13171470#comment-13171470
]
Jonathan Coveney commented on PIG-2267:
---------------------------------------
Find attached a patch that works with trunk. Note, I still need to write some
new tests (I'm still deciding what sort of test is meaningful), but it passes
ant test-commit.
Bags get a schema bag_0 and up, tuples tuple_0 and up, maps map_0 and up, and
the rest get val_ and up (I originally did int_, long_, and so on, but julien
brought up a good point: it's important to be able to change an int to a long,
for example, without breaking the script).
Here are some examples of output:
{code}
a = load 'data' as (tuple(int));
{code}
yields
{code}
a: {tuple_0: (val_0: int)}
{code}
{code}
a = load 'data' as (int,int,int,long,bytearray);
{code}
yields
{code}
a: {val_0: int,val_1: int,val_2: int,val_3: long,val_4: bytearray}
{code}
{code}
a = load 'data' as ({(int,int,int)},{(int,int,int)},{(int,int,int)});
{code}
yields
{code}
a: {bag_0: {(val_0: int,val_1: int,val_2: int)},bag_1: {(val_0: int,val_1:
int,val_2: int)},bag_2: {(val_0: int,val_1: int,val_2: int)}}
{code}
I welcome any suggestions, especially on good tests...
> Make the name of the columns in schema optional
> -----------------------------------------------
>
> Key: PIG-2267
> URL: https://issues.apache.org/jira/browse/PIG-2267
> Project: Pig
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.9.0, 0.10, 0.11
> Reporter: Ashutosh Chauhan
> Assignee: Jonathan Coveney
> Fix For: 0.11
>
>
> Following two works:
> {code}
> a = load 'data';
> a = load 'data' as (f1:int);
> {code}
> Following doesn't:
> {code}
> a = load 'data' as (int);
> {code}
> It will be nice to make names of column optional.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira