This commit is contained in:
nikitamikhaylov 2020-11-02 21:39:54 +03:00
parent 281bf351d2
commit 08b63fde77
3 changed files with 18 additions and 1 deletions

View File

@ -50,6 +50,7 @@ namespace ErrorCodes
extern const int TOO_MANY_TEMPORARY_COLUMNS;
extern const int TOO_MANY_TEMPORARY_NON_CONST_COLUMNS;
extern const int TYPE_MISMATCH;
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
}
/// Read comment near usage
@ -375,7 +376,6 @@ void ExpressionAction::execute(Block & block, bool dry_run) const
auto source = block.getByName(source_name);
block.erase(source_name);
source.column = source.column->convertToFullColumnIfConst();
const ColumnArray * array = typeid_cast<const ColumnArray *>(source.column.get());
if (!array)
throw Exception("ARRAY JOIN of not array: " + source_name, ErrorCodes::TYPE_MISMATCH);
@ -387,6 +387,9 @@ void ExpressionAction::execute(Block & block, bool dry_run) const
source.type = assert_cast<const DataTypeArray &>(*source.type).getNestedType();
source.name = result_name;
if (source.type->getTypeId() == TypeIndex::Nothing)
throw Exception("ARRAY JOIN of empty array is not allowed", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
block.insert(std::move(source));
break;

View File

@ -0,0 +1,12 @@
0
0
0
0
1
1
1
2
2
3
0

View File

@ -0,0 +1,2 @@
SELECT * FROM numbers(4) GROUP BY number WITH TOTALS HAVING sum(number) <= arrayJoin([]); -- { serverError 43 }
SELECT * FROM numbers(4) GROUP BY number WITH TOTALS HAVING sum(number) <= arrayJoin([3, 2, 1, 0]) ORDER BY number;