mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Merge pull request #31800 from kitaisreal/dict-get-with-type-nullable-fix
Function dictGet with type Nullable fix
This commit is contained in:
commit
a426ed0a5a
@ -662,18 +662,13 @@ private:
|
||||
{
|
||||
auto return_type = impl.getReturnTypeImpl(arguments);
|
||||
|
||||
if (!areTypesEqual(return_type, result_type))
|
||||
if (!return_type->equals(*result_type))
|
||||
throw Exception{"Dictionary attribute has different type " + return_type->getName() + " expected " + result_type->getName(),
|
||||
ErrorCodes::TYPE_MISMATCH};
|
||||
|
||||
return impl.executeImpl(arguments, return_type, input_rows_count);
|
||||
}
|
||||
|
||||
static bool areTypesEqual(const DataTypePtr & lhs, const DataTypePtr & rhs)
|
||||
{
|
||||
return removeNullable(recursiveRemoveLowCardinality(lhs))->equals(*removeNullable(recursiveRemoveLowCardinality(rhs)));
|
||||
}
|
||||
|
||||
const FunctionDictGetNoType<dictionary_get_function_type> impl;
|
||||
};
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
Value
|
@ -0,0 +1,22 @@
|
||||
DROP TABLE IF EXISTS 02125_test_table;
|
||||
CREATE TABLE 02125_test_table
|
||||
(
|
||||
id UInt64,
|
||||
value Nullable(String)
|
||||
)
|
||||
ENGINE=TinyLog;
|
||||
|
||||
INSERT INTO 02125_test_table VALUES (0, 'Value');
|
||||
|
||||
DROP DICTIONARY IF EXISTS 02125_test_dictionary;
|
||||
CREATE DICTIONARY 02125_test_dictionary
|
||||
(
|
||||
id UInt64,
|
||||
value Nullable(String)
|
||||
)
|
||||
PRIMARY KEY id
|
||||
SOURCE(CLICKHOUSE(TABLE '02125_test_table'))
|
||||
LAYOUT(DIRECT());
|
||||
|
||||
SELECT dictGet('02125_test_dictionary', 'value', toUInt64(0));
|
||||
SELECT dictGetString('02125_test_dictionary', 'value', toUInt64(0)); --{serverError 53}
|
Loading…
Reference in New Issue
Block a user