Reconstruct tuple columns: input header and flattened columns, return a new vector with tuples reconstructed
| 433 | |
| 434 | /// Reconstruct tuple columns: input header and flattened columns, return a new vector with tuples reconstructed |
| 435 | Columns reconstructTupleColumnsRecursive(const Block & header, const Columns & flattened_columns) |
| 436 | { |
| 437 | Columns result; |
| 438 | result.reserve(header.columns()); |
| 439 | size_t flattened_idx = 0; |
| 440 | |
| 441 | for (size_t i = 0; i < header.columns(); ++i) |
| 442 | { |
| 443 | const auto & header_col = header.getByPosition(i); |
| 444 | result.push_back(reconstructTupleColumnImpl(header_col.type, flattened_columns, flattened_idx)); |
| 445 | } |
| 446 | |
| 447 | if (flattened_idx != flattened_columns.size()) |
| 448 | { |
| 449 | throw Exception( |
| 450 | ErrorCodes::LOGICAL_ERROR, |
| 451 | "reconstructTupleColumnsRecursive: consumed {} flattened columns, but total flattened columns count is {}", |
| 452 | flattened_idx, |
| 453 | flattened_columns.size()); |
| 454 | } |
| 455 | |
| 456 | return result; |
| 457 | } |
| 458 | |
| 459 | namespace |
| 460 | { |