MCPcopy Create free account
hub / github.com/apache/arrow / MakeRandomMapArray

Function MakeRandomMapArray

cpp/src/arrow/ipc/test_common.cc:217–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217Status MakeRandomMapArray(const std::shared_ptr<Array>& key_array,
218 const std::shared_ptr<Array>& item_array, int num_maps,
219 bool include_nulls, MemoryPool* pool,
220 std::shared_ptr<Array>* out) {
221 auto pair_type = struct_(
222 {field("key", key_array->type(), false), field("value", item_array->type())});
223
224 auto pair_array = std::make_shared<StructArray>(pair_type, key_array->length(),
225 ArrayVector{key_array, item_array});
226
227 RETURN_NOT_OK(MakeRandomListArray(pair_array, num_maps, include_nulls, pool, out));
228 auto map_data = (*out)->data();
229 map_data->type = map(key_array->type(), item_array->type());
230 out->reset(new MapArray(map_data));
231 return (**out).Validate();
232}
233
234} // namespace
235

Callers 2

ARROW_ASSIGN_OR_RAISEFunction · 0.85
MakeMapOfDictionaryFunction · 0.85

Calls 9

struct_Function · 0.85
MakeRandomListArrayFunction · 0.85
mapFunction · 0.85
fieldFunction · 0.50
typeMethod · 0.45
lengthMethod · 0.45
dataMethod · 0.45
resetMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected