| 410 | } |
| 411 | |
| 412 | static ColumnPtr reconstructTupleColumnImpl(const DataTypePtr & data_type, const Columns & flattened_columns, size_t & flattened_idx) |
| 413 | { |
| 414 | if (const auto * tuple_type = tryGetFlattenableTuple(data_type)) |
| 415 | { |
| 416 | const auto & element_types = tuple_type->getElements(); |
| 417 | Columns tuple_columns; |
| 418 | tuple_columns.reserve(element_types.size()); |
| 419 | |
| 420 | for (const auto & element_type : element_types) |
| 421 | tuple_columns.push_back(reconstructTupleColumnImpl(element_type, flattened_columns, flattened_idx)); |
| 422 | |
| 423 | return ColumnTuple::create(tuple_columns); |
| 424 | } |
| 425 | |
| 426 | /// For non-tuple types, take as-is from flattened columns |
| 427 | if (flattened_idx >= flattened_columns.size()) |
| 428 | { |
| 429 | throw Exception(ErrorCodes::LOGICAL_ERROR, "flattened_idx out of range in reconstructTupleColumns"); |
| 430 | } |
| 431 | return flattened_columns[flattened_idx++]; |
| 432 | } |
| 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) |
no test coverage detected