Hi,

I'd like to be able to flatten a map, so each K->V is flattened into
it's own row. Basically something like this:

cat map_data.txt
32      [123#bill,222#joe]
77      [977#mary,987#jane]
44      [23#tim,437#maria]

A = LOAD 'map_data.txt' AS (id:int, friends:map[]);
B = FOREACH A GENERATE id, FLATTEN(friends);
dump B;

32      (123,bill)
32      (222,joe)
77      (977,mary)
77      (987,jane)
44      (23,tim)
44      (437,maria)

The problem though, is that flatten doesn't seem to work on maps and
instead B is the same as A. The only map-related functionality I've
been able to find is pulling values by a known key, or returning the
map size.

Does anyone have any suggestions for how I could do this? Is it
possible to write/extend/patch something to provide this
functionality?

thanks,
Bill

Reply via email to