MCPcopy Create free account
hub / github.com/ByConity/ByConity / createConcreteEmptyDynamicColumn

Function createConcreteEmptyDynamicColumn

src/DataTypes/ObjectUtils.cpp:465–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

463}
464
465DataTypePtr 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
497void extendObjectColumns(NamesAndTypesList & columns_list, const ColumnsDescription & object_columns, bool with_subcolumns)
498{

Callers 2

getConcreteObjectColumnsFunction · 0.85

Calls 11

isObjectFunction · 0.85
getNestedTypeMethod · 0.80
ExceptionClass · 0.50
hasDynamicSubcolumnsMethod · 0.45
getMethod · 0.45
getElementsMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected