mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Allow cast from Array(Nothing) to Map(Nothing, Nothing)
This commit is contained in:
parent
6c0450f8ff
commit
3eec3f8675
@ -7,6 +7,7 @@
|
||||
#include <Columns/ColumnFixedString.h>
|
||||
#include <Columns/ColumnLowCardinality.h>
|
||||
#include <Columns/ColumnMap.h>
|
||||
#include <Columns/ColumnNothing.h>
|
||||
#include <Columns/ColumnNullable.h>
|
||||
#include <Columns/ColumnObject.h>
|
||||
#include <Columns/ColumnString.h>
|
||||
@ -3770,6 +3771,12 @@ private:
|
||||
}
|
||||
else if (const auto * from_array = typeid_cast<const DataTypeArray *>(from_type_untyped.get()))
|
||||
{
|
||||
if (typeid_cast<const DataTypeNothing *>(from_array->getNestedType().get()))
|
||||
return [nested = to_type->getNestedType()](ColumnsWithTypeAndName &, const DataTypePtr &, const ColumnNullable *, size_t size)
|
||||
{
|
||||
return ColumnMap::create(nested->createColumnConstWithDefaultValue(size)->convertToFullColumnIfConst());
|
||||
};
|
||||
|
||||
const auto * nested_tuple = typeid_cast<const DataTypeTuple *>(from_array->getNestedType().get());
|
||||
if (!nested_tuple || nested_tuple->getElements().size() != 2)
|
||||
throw Exception(
|
||||
|
@ -2,3 +2,6 @@
|
||||
{'a':1,'b':2}
|
||||
{'a':1,'b':2}
|
||||
{'a':1,'b':2}
|
||||
{}
|
||||
{}
|
||||
{'':''}
|
||||
|
@ -1,2 +1,8 @@
|
||||
SELECT map('a', 1, 'b', 2) FROM remote('127.0.0.{1,2}', system, one);
|
||||
SELECT map('a', 1, 'b', 2) FROM remote('127.0.0.{1,2}');
|
||||
|
||||
SELECT map() from remote('127.0.0.{1,2}', system,one);
|
||||
|
||||
drop table if exists bug_repro_local;
|
||||
CREATE TABLE bug_repro_local (`attributes` Map(LowCardinality(String), String)) ENGINE = Log as select map('','');
|
||||
SELECT if(1, attributes, map()) from remote('127.0.0.{1,2}', default,bug_repro_local) limit 1;
|
||||
|
Loading…
Reference in New Issue
Block a user