Allow to search tuple of NULLs in a set

This commit is contained in:
Alexey Milovidov 2021-03-24 03:15:48 +03:00
parent 4de5afed4e
commit eae268f2f0
3 changed files with 9 additions and 0 deletions

View File

@ -377,6 +377,11 @@ Field convertFieldToType(const Field & from_value, const IDataType & to_type, co
else if (const auto * nullable_type = typeid_cast<const DataTypeNullable *>(&to_type)) else if (const auto * nullable_type = typeid_cast<const DataTypeNullable *>(&to_type))
{ {
const IDataType & nested_type = *nullable_type->getNestedType(); const IDataType & nested_type = *nullable_type->getNestedType();
/// NULL remains NULL after any conversion.
if (WhichDataType(nested_type).isNothing())
return {};
if (from_type_hint && from_type_hint->equals(nested_type)) if (from_type_hint && from_type_hint->equals(nested_type))
return from_value; return from_value;
return convertFieldToTypeImpl(from_value, nested_type, from_type_hint); return convertFieldToTypeImpl(from_value, nested_type, from_type_hint);

View File

@ -0,0 +1,2 @@
0
0

View File

@ -0,0 +1,2 @@
SELECT (NULL, NULL) = (8, 0) OR (NULL, NULL) = (3, 2) OR (NULL, NULL) = (0, 0) OR (NULL, NULL) = (3, 1);
SELECT (NULL, NULL) IN ((NULL, 0), (3, 1), (3, 2), (8, 0));