Fixed LEFT ARRAY JOIN for constant arrays [#CLICKHOUSE-2946].

This commit is contained in:
Alexey Milovidov 2017-04-19 07:03:11 +03:00
parent be316af758
commit 3de78d093b
3 changed files with 13 additions and 1 deletions

View File

@ -372,7 +372,10 @@ void ExpressionAction::execute(Block & block) const
}
any_array_ptr = non_empty_array_columns.begin()->second;
any_array = typeid_cast<const ColumnArray *>(&*any_array_ptr);
if (auto converted = any_array_ptr->convertToFullColumnIfConst())
any_array_ptr = converted;
any_array = &typeid_cast<const ColumnArray &>(*any_array_ptr);
}
size_t columns = block.columns();

View File

@ -0,0 +1,6 @@
[1] 1
[] 0
[] 0
[1] 1
[2,3] 2
[2,3] 3

View File

@ -0,0 +1,3 @@
SELECT arr, element FROM (SELECT [1] AS arr) LEFT ARRAY JOIN arr AS element;
SELECT arr, element FROM (SELECT emptyArrayUInt8() AS arr) LEFT ARRAY JOIN arr AS element;
SELECT arr, element FROM (SELECT arrayJoin([emptyArrayUInt8(), [1], [2, 3]]) AS arr) LEFT ARRAY JOIN arr AS element;