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

Function sanitizeDataType

src/Interpreters/ExpressionAnalyzer.cpp:193–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193void sanitizeDataType(const DataTypePtr & type)
194{
195 if (!type)
196 throw Exception("Invalid null type for filter:, must be UInt8 or Nullable(UInt8)",
197 ErrorCodes::ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER);
198
199 if (type->getTypeId() == TypeIndex::Nullable)
200 {
201 const auto * nullable = dynamic_cast<const DataTypeNullable *>(type.get());
202 sanitizeDataType(nullable->getNestedType());
203 return;
204 }
205
206 if (type->getTypeId() == TypeIndex::LowCardinality)
207 {
208 const auto * lc = dynamic_cast<const DataTypeLowCardinality *>(type.get());
209 sanitizeDataType(lc->getDictionaryType());
210 return;
211 }
212
213 if(type->getTypeId() == TypeIndex::UInt8)
214 return;
215
216 throw Exception("Invalid type for filter: " + type->getName() + ", must be UInt8 or Nullable(UInt8)",
217 ErrorCodes::ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER);
218}
219
220ExpressionAnalyzerData::~ExpressionAnalyzerData() = default;
221

Callers 1

Calls 5

getNestedTypeMethod · 0.80
ExceptionClass · 0.70
getTypeIdMethod · 0.45
getMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected