Fix exception type in arrayElement (#47909)

This commit is contained in:
Nikolay Degterinsky 2023-03-23 16:01:04 +01:00 committed by GitHub
parent 4fcc5bbea7
commit 531068df16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1179,12 +1179,15 @@ ColumnPtr FunctionArrayElement::perform(const ColumnsWithTypeAndName & arguments
|| (res = executeArgument<Int16>(arguments, result_type, builder, input_rows_count)) || (res = executeArgument<Int16>(arguments, result_type, builder, input_rows_count))
|| (res = executeArgument<Int32>(arguments, result_type, builder, input_rows_count)) || (res = executeArgument<Int32>(arguments, result_type, builder, input_rows_count))
|| (res = executeArgument<Int64>(arguments, result_type, builder, input_rows_count)))) || (res = executeArgument<Int64>(arguments, result_type, builder, input_rows_count))))
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Second argument for function {} must have UInt or Int type.", getName()); throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Second argument for function {} must have UInt or Int type", getName());
} }
else else
{ {
Field index = (*arguments[1].column)[0]; Field index = (*arguments[1].column)[0];
if (index.getType() != Field::Types::UInt64 && index.getType() != Field::Types::Int64)
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Second argument for function {} must have UInt or Int type", getName());
if (builder) if (builder)
builder.initSink(input_rows_count); builder.initSink(input_rows_count);