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

Function GetMultiSegmentKeyOutput

cpp/src/arrow/acero/hash_aggregate_test.cc:5382–5395  ·  view source on GitHub ↗

adds a named copy of the first(single-segment-key) column to the expected output table

Source from the content-addressed store, hash-verified

5380
5381// adds a named copy of the first(single-segment-key) column to the expected output table
5382Result<std::shared_ptr<ChunkedArray>> GetMultiSegmentKeyOutput(
5383 const std::string& add_name) {
5384 ARROW_ASSIGN_OR_RAISE(auto chunked, GetSingleSegmentKeyOutput());
5385 ARROW_ASSIGN_OR_RAISE(auto table, Table::FromChunkedStructArray(chunked));
5386 int existing_key_field_idx = 0;
5387 auto add_field =
5388 field(add_name, table->schema()->field(existing_key_field_idx)->type());
5389 ARROW_ASSIGN_OR_RAISE(auto added,
5390 table->AddColumn(existing_key_field_idx + 1, add_field,
5391 table->column(existing_key_field_idx)));
5392 ARROW_ASSIGN_OR_RAISE(auto batch, added->CombineChunksToBatch());
5393 ARROW_ASSIGN_OR_RAISE(auto array, batch->ToStructArray());
5394 return ChunkedArray::Make({array->Slice(0, 4), array->Slice(4, 4)}, array->type());
5395}
5396
5397void TestMultiSegmentKey(
5398 GroupByFunction group_by,

Callers

nothing calls this directly

Calls 6

fieldFunction · 0.50
MakeFunction · 0.50
typeMethod · 0.45
fieldMethod · 0.45
schemaMethod · 0.45
SliceMethod · 0.45

Tested by

no test coverage detected