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

Daniel Dai commented on PIG-4219:
---------------------------------

I don't completely recall but that probably to address the backward 
compatibility. Before we can define the bag as bag{num1: int,num2: int} and 
compiler will automatically add a tuple. So when we get bag schema back, we 
don't know the inner tuple is artificially added or the original one, so we use 
this brutal rule. Now I don't think it is a problem. bag{num1: int,num2: int} 
syntax is deprecated for versions, we don't need this rule, which is wrong 
anyway.

So I +1 for the patch, but please add a test case.

> When parsing a schema, pig drops tuple inside of Bag if it contains only one 
> field
> ----------------------------------------------------------------------------------
>
>                 Key: PIG-4219
>                 URL: https://issues.apache.org/jira/browse/PIG-4219
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Julien Le Dem
>         Attachments: PIG-4219.patch
>
>
> Example
> {code:java}
> //We generate a schema object and call toString()
> String schemaStr = "my_list: {array: (array_element: (num1: int,num2: int))}";
> // Reparsed using org.apache.pig.impl.util.Utils
> Schema schema = Utils.getSchemaFromString(schemaStr);
> // But no longer matches the original structure
> schema.toString();
> // => {my_list: {array_element: (num1: int,num2: int)}}
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to