adds a named copy of the first(single-segment-key) column to the expected output table
| 5380 | |
| 5381 | // adds a named copy of the first(single-segment-key) column to the expected output table |
| 5382 | Result<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 | |
| 5397 | void TestMultiSegmentKey( |
| 5398 | GroupByFunction group_by, |