mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge pull request #27423 from fuwhu/feature/correct-key-type-in-mapContains
Correct the key data type used in mapContains
This commit is contained in:
commit
4d9fae2e18
@ -184,9 +184,11 @@ public:
|
||||
{
|
||||
bool is_const = isColumnConst(*arguments[0].column);
|
||||
const ColumnMap * col_map = is_const ? checkAndGetColumnConstData<ColumnMap>(arguments[0].column.get()) : checkAndGetColumn<ColumnMap>(arguments[0].column.get());
|
||||
if (!col_map)
|
||||
const DataTypeMap * map_type = checkAndGetDataType<DataTypeMap>(arguments[0].type.get());
|
||||
if (!col_map || !map_type)
|
||||
throw Exception{"First argument for function " + getName() + " must be a map", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT};
|
||||
|
||||
auto key_type = map_type->getKeyType();
|
||||
const auto & nested_column = col_map->getNestedColumn();
|
||||
const auto & keys_data = col_map->getNestedData().getColumn(0);
|
||||
|
||||
@ -196,7 +198,7 @@ public:
|
||||
{
|
||||
{
|
||||
is_const ? ColumnConst::create(std::move(column_array), keys_data.size()) : std::move(column_array),
|
||||
std::make_shared<DataTypeArray>(result_type),
|
||||
std::make_shared<DataTypeArray>(key_type),
|
||||
""
|
||||
},
|
||||
arguments[1]
|
||||
|
Loading…
Reference in New Issue
Block a user