mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
fix fuzzer
This commit is contained in:
parent
39b9d00373
commit
1a6cdb3a6f
@ -128,6 +128,13 @@ bool DataTypeMap::checkKeyType(DataTypePtr key_type)
|
||||
return true;
|
||||
}
|
||||
|
||||
DataTypePtr DataTypeMap::getNestedTypeWithUnnamedTuple() const
|
||||
{
|
||||
const auto & from_array = assert_cast<const DataTypeArray &>(*nested);
|
||||
const auto & from_tuple = assert_cast<const DataTypeTuple &>(*from_array.getNestedType());
|
||||
return std::make_shared<DataTypeArray>(std::make_shared<DataTypeTuple>(from_tuple.getElements()));
|
||||
}
|
||||
|
||||
static DataTypePtr create(const ASTPtr & arguments)
|
||||
{
|
||||
if (!arguments || arguments->children.size() != 2)
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
const DataTypePtr & getValueType() const { return value_type; }
|
||||
DataTypes getKeyValueTypes() const { return {key_type, value_type}; }
|
||||
const DataTypePtr & getNestedType() const { return nested; }
|
||||
DataTypePtr getNestedTypeWithUnnamedTuple() const;
|
||||
|
||||
SerializationPtr doGetDefaultSerialization() const override;
|
||||
|
||||
|
@ -3106,9 +3106,7 @@ private:
|
||||
{
|
||||
/// Recreate array of unnamed tuples because otherwise it may work
|
||||
/// unexpectedly while converting to array of named tuples.
|
||||
const auto & from_array = assert_cast<const DataTypeArray &>(*from_type_map->getNestedType());
|
||||
const auto & from_tuple = assert_cast<const DataTypeTuple &>(*from_array.getNestedType());
|
||||
from_type_holder = std::make_shared<DataTypeArray>(std::make_shared<DataTypeTuple>(from_tuple.getElements()));
|
||||
from_type_holder = from_type_map->getNestedTypeWithUnnamedTuple();
|
||||
from_type = assert_cast<const DataTypeArray *>(from_type_holder.get());
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ struct MapToNestedAdapter : public MapAdapterBase<MapToNestedAdapter<Name, retur
|
||||
|
||||
static DataTypePtr extractNestedType(const DataTypeMap & type_map)
|
||||
{
|
||||
return type_map.getNestedType();
|
||||
return type_map.getNestedTypeWithUnnamedTuple();
|
||||
}
|
||||
|
||||
static ColumnPtr extractNestedColumn(const ColumnMap & column_map)
|
||||
@ -274,7 +274,7 @@ struct MapKeyLikeAdapter
|
||||
function_column = ColumnFunction::create(pattern_arg.column->size(), std::move(function_base), ColumnsWithTypeAndName{pattern_arg});
|
||||
}
|
||||
|
||||
ColumnWithTypeAndName function_arg{std::move(function_column), std::move(function_type), "__function_map_key_like"};
|
||||
ColumnWithTypeAndName function_arg{function_column, function_type, "__function_map_key_like"};
|
||||
arguments = {function_arg, arguments[0]};
|
||||
MapToNestedAdapter<Name, returns_map>::extractNestedTypesAndColumns(arguments);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user