MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / hasNullable

Function hasNullable

src/DataTypes/hasNullable.cpp:10–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8{
9
10bool hasNullable(const DataTypePtr & type)
11{
12 if (isNullableOrLowCardinalityNullable(type))
13 return true;
14
15 if (const DataTypeArray * type_array = typeid_cast<const DataTypeArray *>(type.get()))
16 return hasNullable(type_array->getNestedType());
17 if (const DataTypeTuple * type_tuple = typeid_cast<const DataTypeTuple *>(type.get()))
18 {
19 for (const auto & subtype : type_tuple->getElements())
20 {
21 if (hasNullable(subtype))
22 return true;
23 }
24 return false;
25 }
26 if (const DataTypeMap * type_map = typeid_cast<const DataTypeMap *>(type.get()))
27 {
28 // Key type cannot be nullable. We only check value type.
29 return hasNullable(type_map->getValueType());
30 }
31 return false;
32}
33
34bool hasTypeThatCanContainNulls(const DataTypePtr & type)
35{

Callers 2

checkKeyExpressionFunction · 0.85
getColumnTypeMethod · 0.85

Calls 4

getNestedTypeMethod · 0.80
getMethod · 0.45
getElementsMethod · 0.45

Tested by

no test coverage detected