diff --git a/src/Functions/FunctionsConversion.h b/src/Functions/FunctionsConversion.h index 10aa1987559..c732ce5f931 100644 --- a/src/Functions/FunctionsConversion.h +++ b/src/Functions/FunctionsConversion.h @@ -2641,7 +2641,7 @@ private: 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] - (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 & column_map = typeid_cast(*col); @@ -2651,7 +2651,7 @@ private: for (size_t i = 0; i < 2; ++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()); @@ -2662,7 +2662,7 @@ private: 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] - (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 & column_array = typeid_cast(*col); @@ -2672,7 +2672,7 @@ private: for (size_t i = 0; i < 2; ++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()); diff --git a/tests/queries/0_stateless/01803_const_nullable_map.reference b/tests/queries/0_stateless/01803_const_nullable_map.reference new file mode 100644 index 00000000000..573541ac970 --- /dev/null +++ b/tests/queries/0_stateless/01803_const_nullable_map.reference @@ -0,0 +1 @@ +0 diff --git a/tests/queries/0_stateless/01803_const_nullable_map.sql b/tests/queries/0_stateless/01803_const_nullable_map.sql new file mode 100644 index 00000000000..4ac9f925e24 --- /dev/null +++ b/tests/queries/0_stateless/01803_const_nullable_map.sql @@ -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;