mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 04:12:19 +00:00
fix conversion from const map with nulls
This commit is contained in:
parent
30f2d839c3
commit
329c9033a8
@ -2641,7 +2641,7 @@ private:
|
|||||||
WrapperType createMapToMapWrrapper(const DataTypes & from_kv_types, const DataTypes & to_kv_types) const
|
WrapperType createMapToMapWrrapper(const DataTypes & from_kv_types, const DataTypes & to_kv_types) const
|
||||||
{
|
{
|
||||||
return [element_wrappers = getElementWrappers(from_kv_types, to_kv_types), from_kv_types, to_kv_types]
|
return [element_wrappers = getElementWrappers(from_kv_types, to_kv_types), from_kv_types, to_kv_types]
|
||||||
(ColumnsWithTypeAndName & arguments, const DataTypePtr &, const ColumnNullable * nullable_source, size_t input_rows_count) -> ColumnPtr
|
(ColumnsWithTypeAndName & arguments, const DataTypePtr &, const ColumnNullable * nullable_source, size_t /*input_rows_count*/) -> ColumnPtr
|
||||||
{
|
{
|
||||||
const auto * col = arguments.front().column.get();
|
const auto * col = arguments.front().column.get();
|
||||||
const auto & column_map = typeid_cast<const ColumnMap &>(*col);
|
const auto & column_map = typeid_cast<const ColumnMap &>(*col);
|
||||||
@ -2651,7 +2651,7 @@ private:
|
|||||||
for (size_t i = 0; i < 2; ++i)
|
for (size_t i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
ColumnsWithTypeAndName element = {{nested_data.getColumnPtr(i), from_kv_types[i], ""}};
|
ColumnsWithTypeAndName element = {{nested_data.getColumnPtr(i), from_kv_types[i], ""}};
|
||||||
converted_columns[i] = element_wrappers[i](element, to_kv_types[i], nullable_source, input_rows_count);
|
converted_columns[i] = element_wrappers[i](element, to_kv_types[i], nullable_source, (element[0].column)->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ColumnMap::create(converted_columns[0], converted_columns[1], column_map.getNestedColumn().getOffsetsPtr());
|
return ColumnMap::create(converted_columns[0], converted_columns[1], column_map.getNestedColumn().getOffsetsPtr());
|
||||||
@ -2662,7 +2662,7 @@ private:
|
|||||||
WrapperType createArrayToMapWrrapper(const DataTypes & from_kv_types, const DataTypes & to_kv_types) const
|
WrapperType createArrayToMapWrrapper(const DataTypes & from_kv_types, const DataTypes & to_kv_types) const
|
||||||
{
|
{
|
||||||
return [element_wrappers = getElementWrappers(from_kv_types, to_kv_types), from_kv_types, to_kv_types]
|
return [element_wrappers = getElementWrappers(from_kv_types, to_kv_types), from_kv_types, to_kv_types]
|
||||||
(ColumnsWithTypeAndName & arguments, const DataTypePtr &, const ColumnNullable * nullable_source, size_t input_rows_count) -> ColumnPtr
|
(ColumnsWithTypeAndName & arguments, const DataTypePtr &, const ColumnNullable * nullable_source, size_t /*input_rows_count*/) -> ColumnPtr
|
||||||
{
|
{
|
||||||
const auto * col = arguments.front().column.get();
|
const auto * col = arguments.front().column.get();
|
||||||
const auto & column_array = typeid_cast<const ColumnArray &>(*col);
|
const auto & column_array = typeid_cast<const ColumnArray &>(*col);
|
||||||
@ -2672,7 +2672,7 @@ private:
|
|||||||
for (size_t i = 0; i < 2; ++i)
|
for (size_t i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
ColumnsWithTypeAndName element = {{nested_data.getColumnPtr(i), from_kv_types[i], ""}};
|
ColumnsWithTypeAndName element = {{nested_data.getColumnPtr(i), from_kv_types[i], ""}};
|
||||||
converted_columns[i] = element_wrappers[i](element, to_kv_types[i], nullable_source, input_rows_count);
|
converted_columns[i] = element_wrappers[i](element, to_kv_types[i], nullable_source, (element[0].column)->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ColumnMap::create(converted_columns[0], converted_columns[1], column_array.getOffsetsPtr());
|
return ColumnMap::create(converted_columns[0], converted_columns[1], column_array.getOffsetsPtr());
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
0
|
9
tests/queries/0_stateless/01803_const_nullable_map.sql
Normal file
9
tests/queries/0_stateless/01803_const_nullable_map.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
DROP TABLE IF EXISTS t_map_null;
|
||||||
|
|
||||||
|
SET allow_experimental_map_type = 1;
|
||||||
|
|
||||||
|
CREATE TABLE t_map_null (a Map(String, String), b String) engine = MergeTree() ORDER BY a;
|
||||||
|
INSERT INTO t_map_null VALUES (map('a', 'b', 'c', 'd'), 'foo');
|
||||||
|
SELECT count() FROM t_map_null WHERE a = map('name', NULL, '', NULL);
|
||||||
|
|
||||||
|
DROP TABLE t_map_null;
|
Loading…
Reference in New Issue
Block a user