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

Rohini Palaniswamy commented on PIG-4674:
-----------------------------------------

TOMAP also accepts a bag with 'pair' tuples (i.e. tuples with a 'key' and a 
'value'). That is not handled. Can also simplify code to

{code}
+        Byte valueType = null;
+        if (input != null && input.getFields()!=null) {
            if (input.size() == 1) {
                   //Code for bag of tuple pairs case. Get valueType of the 
second field in tuple
            } else {
                   valueType = input.getFields().get(1).type;
             }
+        }
+        Schema s = new Schema(new Schema.FieldSchema(null, DataType.MAP));
+        if (valueType != null && valueType != DataType.BYTEARRAY) {
+            s.getFields().get(0).schema = new Schema(new 
Schema.FieldSchema(null, valueType));
+            return s;
+        }
{code} 

> TOMAP should infer schema
> -------------------------
>
>                 Key: PIG-4674
>                 URL: https://issues.apache.org/jira/browse/PIG-4674
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>            Reporter: Daniel Dai
>            Assignee: Daniel Dai
>             Fix For: 0.16.0
>
>         Attachments: PIG-4674-1.patch
>
>
> TOMAP schema is map only without map value schema. This should be inferred if 
> available.



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

Reply via email to