mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Fix Nullable String to Enum conversion.
This commit is contained in:
parent
fbf06f9858
commit
4c3c1cdaf3
@ -2260,9 +2260,7 @@ private:
|
||||
|
||||
size_t nullable_pos = block.columns() - 1;
|
||||
nullable_col = typeid_cast<const ColumnNullable *>(block.getByPosition(nullable_pos).column.get());
|
||||
if (!nullable_col)
|
||||
throw Exception("Last column should be ColumnNullable", ErrorCodes::LOGICAL_ERROR);
|
||||
if (col && nullable_col->size() != col->size())
|
||||
if (col && nullable_col && nullable_col->size() != col->size())
|
||||
throw Exception("ColumnNullable is not compatible with original", ErrorCodes::LOGICAL_ERROR);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
hello
|
12
tests/queries/0_stateless/01490_nullable_string_to_enum.sql
Normal file
12
tests/queries/0_stateless/01490_nullable_string_to_enum.sql
Normal file
@ -0,0 +1,12 @@
|
||||
DROP TABLE IF EXISTS t_enum;
|
||||
DROP TABLE IF EXISTS t_source;
|
||||
|
||||
CREATE TABLE t_enum(x Enum8('hello' = 1, 'world' = 2)) ENGINE = TinyLog;
|
||||
CREATE TABLE t_source(x Nullable(String)) ENGINE = TinyLog;
|
||||
|
||||
INSERT INTO t_source (x) VALUES ('hello');
|
||||
INSERT INTO t_enum(x) SELECT x from t_source WHERE x in ('hello', 'world');
|
||||
SELECT * FROM t_enum;
|
||||
|
||||
DROP TABLE IF EXISTS t_enum;
|
||||
DROP TABLE IF EXISTS t_source;
|
Loading…
Reference in New Issue
Block a user