| 8 | { |
| 9 | |
| 10 | bool 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 | |
| 34 | bool hasTypeThatCanContainNulls(const DataTypePtr & type) |
| 35 | { |
no test coverage detected