adds a named copy of the first(single-segment-key) column to the expected output table
| 5457 | |
| 5458 | // adds a named copy of the first(single-segment-key) column to the expected output table |
| 5459 | Result<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 | |
| 5474 | void TestMultiSegmentKey( |
| 5475 | GroupByFunction group_by, |