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

Function getDataTypeByColumn

src/DataTypes/ObjectUtils.cpp:111–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111DataTypePtr getDataTypeByColumn(const IColumn & column)
112{
113 auto idx = column.getDataType();
114 WhichDataType which(idx);
115 if (which.isSimple())
116 return DataTypeFactory::instance().get(String(magic_enum::enum_name(idx)));
117
118 if (which.isNothing())
119 return std::make_shared<DataTypeNothing>();
120
121 if (const auto * column_array = checkAndGetColumn<ColumnArray>(&column))
122 return std::make_shared<DataTypeArray>(getDataTypeByColumn(column_array->getData()));
123
124 if (const auto * column_nullable = checkAndGetColumn<ColumnNullable>(&column))
125 return makeNullable(getDataTypeByColumn(column_nullable->getNestedColumn()));
126
127 /// TODO: add more types.
128 throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot get data type of column {}", column.getFamilyName());
129}
130
131template <size_t I, typename Tuple>
132static auto extractVector(const std::vector<Tuple> & vec)

Callers 5

SubcolumnMethod · 0.85
checkTypesMethod · 0.85
insertRangeFromMethod · 0.85
finalizeMethod · 0.85

Calls 9

isSimpleMethod · 0.80
isNothingMethod · 0.80
makeNullableFunction · 0.70
StringClass · 0.50
ExceptionClass · 0.50
getDataTypeMethod · 0.45
getMethod · 0.45
getDataMethod · 0.45
getFamilyNameMethod · 0.45

Tested by

no test coverage detected