You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "ZMZ91 (Jira)" <ji...@apache.org> on 2020/07/26 03:30:00 UTC

[jira] [Created] (ARROW-9558) [MapArray] The key-value structure is confusing in MapArray constructor.

ZMZ91 created ARROW-9558:
----------------------------

             Summary: [MapArray] The key-value structure is confusing in MapArray constructor.
                 Key: ARROW-9558
                 URL: https://issues.apache.org/jira/browse/ARROW-9558
             Project: Apache Arrow
          Issue Type: Bug
            Reporter: ZMZ91


I'm trying to build a MapArray and found following constructor from array_nested.cc.
{code:c++}
MapArray::MapArray(const std::shared_ptr<DataType>& type, int64_t length,
 const std::shared_ptr<Buffer>& offsets,
 const std::shared_ptr<Array>& keys,
 const std::shared_ptr<Array>& items,
 const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count,
 int64_t offset) {
 auto pair_data = ArrayData::Make(type->fields()[0]->type(), keys->data()->length,
 {nullptr}, {keys->data(), items->data()}, 0, offset);
 auto map_data = ArrayData::Make(type, length, {null_bitmap, offsets}, {pair_data},
 null_count, offset);
 SetData(map_data);
}
 {code}
But I can't tell how to split keys/items into different maps. From the code, all keys and items data are attached to pair_data as children and the pair_data then as a child to map_data. Then how to determine each key/item go to which map? For example, how to determine which map array to output. Is that controlled by param `offsets`? If so, is key/item number the unit for offsets? Say following example, the offsets should be like \{0, 2, 4, ...} and \{0, 1, 4, ...}

{

{key1: item1, key2: item2},

{key3: item3, key4: item4},

...

}

{

{key1: item1},

{key2: item2, key3: item3, key4: item4}

...

}

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)