| 463 | } |
| 464 | |
| 465 | DataTypePtr createConcreteEmptyDynamicColumn(const DataTypePtr & type_in_storage) |
| 466 | { |
| 467 | if (!type_in_storage->hasDynamicSubcolumns()) |
| 468 | return type_in_storage; |
| 469 | |
| 470 | if (isObject(type_in_storage)) |
| 471 | return std::make_shared<DataTypeTuple>( |
| 472 | DataTypes{std::make_shared<DataTypeUInt8>()}, Names{ColumnObject::COLUMN_NAME_DUMMY}); |
| 473 | |
| 474 | if (const auto * type_array = typeid_cast<const DataTypeArray *>(type_in_storage.get())) |
| 475 | return std::make_shared<DataTypeArray>( |
| 476 | createConcreteEmptyDynamicColumn(type_array->getNestedType())); |
| 477 | |
| 478 | if (const auto * type_map = typeid_cast<const DataTypeMap *>(type_in_storage.get())) |
| 479 | return std::make_shared<DataTypeMap>( |
| 480 | createConcreteEmptyDynamicColumn(type_map->getNestedType())); |
| 481 | |
| 482 | if (const auto * type_tuple = typeid_cast<const DataTypeTuple *>(type_in_storage.get())) |
| 483 | { |
| 484 | const auto & elements = type_tuple->getElements(); |
| 485 | DataTypes new_elements; |
| 486 | new_elements.reserve(elements.size()); |
| 487 | |
| 488 | for (const auto & element : elements) |
| 489 | new_elements.push_back(createConcreteEmptyDynamicColumn(element)); |
| 490 | |
| 491 | return recreateTupleWithElements(*type_tuple, new_elements); |
| 492 | } |
| 493 | |
| 494 | throw Exception(ErrorCodes::LOGICAL_ERROR, "Type {} unexpectedly has dynamic columns", type_in_storage->getName()); |
| 495 | } |
| 496 | |
| 497 | void extendObjectColumns(NamesAndTypesList & columns_list, const ColumnsDescription & object_columns, bool with_subcolumns) |
| 498 | { |
no test coverage detected