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

Thejas M Nair commented on PIG-1016:
------------------------------------

A tuple can also be used instead of a typed map. 
This issue is specific to PigStorage load function, and it is present because 
it tries to auto-detect the map value type. I don't think we need to introduce 
a typed map in pig-latin for this. You can always create a new load function 
that returns typed maps. BinStorage() is an example of a Load/store function 
that stores the type information in data, and returns typed maps.
I think run-time identification of type is a bad idea, it results in 
surprising/unpredictable behavior.

In case of PigStorage(), I think it should always interpret the map-value as 
bytearray. In the pig-script , the user can cast the value to the expected 
type. PigStorage.bytesTo... functions would get used for this purpose. (I 
assume pig keeps track of the loader function that produced the data).
Map parsing will also be faster with this approach, compared to auto-detect of 
value type.


> Reading in map data seems broken
> --------------------------------
>
>                 Key: PIG-1016
>                 URL: https://issues.apache.org/jira/browse/PIG-1016
>             Project: Pig
>          Issue Type: Improvement
>          Components: data
>    Affects Versions: 0.4.0
>            Reporter: hc busy
>             Fix For: 0.5.0
>
>         Attachments: PIG-1016.patch
>
>
> Hi, I'm trying to load a map that has a tuple for value. The read fails in 
> 0.4.0 because of a misconfiguration in the parser. Where as in almost all 
> documentation it is stated that value of the map can be any time.
> I've attached a patch that allows us to read in complex objects as value as 
> documented. I've done simple verification of loading in maps with tuple/map 
> values and writing them back out using LOAD and STORE. All seems to work fine.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to