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

Function GetMultiSegmentKeyOutput

cpp/src/arrow/acero/hash_aggregate_test.cc:5459–5472  ·  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

5457
5458// adds a named copy of the first(single-segment-key) column to the expected output table
5459Result<std::shared_ptr<ChunkedArray>> GetMultiSegmentKeyOutput(
5460 const std::string& add_name) {
5461 ARROW_ASSIGN_OR_RAISE(auto chunked, GetSingleSegmentKeyOutput());
5462 ARROW_ASSIGN_OR_RAISE(auto table, Table::FromChunkedStructArray(chunked));
5463 int existing_key_field_idx = 0;
5464 auto add_field =
5465 field(add_name, table->schema()->field(existing_key_field_idx)->type());
5466 ARROW_ASSIGN_OR_RAISE(auto added,
5467 table->AddColumn(existing_key_field_idx + 1, add_field,
5468 table->column(existing_key_field_idx)));
5469 ARROW_ASSIGN_OR_RAISE(auto batch, added->CombineChunksToBatch());
5470 ARROW_ASSIGN_OR_RAISE(auto array, batch->ToStructArray());
5471 return ChunkedArray::Make({array->Slice(0, 4), array->Slice(4, 4)}, array->type());
5472}
5473
5474void TestMultiSegmentKey(
5475 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