[ https://issues.apache.org/jira/browse/PIG-2600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13231360#comment-13231360 ]
Prashant Kommireddi commented on PIG-2600: ------------------------------------------ INVERSEMAP is a nice to have functionality, not necessarily uber-useful. This could be similar to http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/BiMap.html except the fact that it does not require the restriction that values are unique. Rather we could think of a strategy to determine which value->key pairs the function returns 1. First occurring pair, key pair -> (v1, k1) from (k1,v1)(k2,v1) 2. Last occurring pair -> (v1, k2) from (k1,v1)(k2,v1) 3. All keys corresponding to value -> (v1, (k1,k2)) Input could be tuple of maps or bag of maps. INVERSEMAP has been useful in a few situations to me, for eg to get field->index map from index->field. I see it being useful in few cases with click-through analysis as well. Again, not a super required use-case but good to have. > Better Map support > ------------------ > > Key: PIG-2600 > URL: https://issues.apache.org/jira/browse/PIG-2600 > Project: Pig > Issue Type: Improvement > Reporter: Jonathan Coveney > Fix For: 0.11 > > > It would be nice if Pig played better with Maps. To that end, I'd like to add > a lot of utility around Maps. > - TOBAG should take a Map and output {(key, value)} > - TOMAP should take a Bag in that same form and make a map. > - KEYSET should return the set of keys. > - VALUESET should return the set of values. > - VALUELIST should return the List of values (no deduping). > - INVERSEMAP would return a Map of values => the set of keys that refer to > that Key > This would all be pretty easy. A more substantial piece of work would be to > make Pig support non-String keys (this is especially an issue since UDFs and > whatnot probably assume that they are all Integers). Not sure if it is worth > it. > I'd love to hear other things that would be useful for people! -- 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