diff --git a/be/src/vec/functions/array/function_array_with_constant.cpp b/be/src/vec/functions/array/function_array_with_constant.cpp index 9e3885b1c3cf5a..724f3cc1316ee6 100644 --- a/be/src/vec/functions/array/function_array_with_constant.cpp +++ b/be/src/vec/functions/array/function_array_with_constant.cpp @@ -92,9 +92,9 @@ class FunctionArrayWithConstant : public IFunction { array_sizes.reserve(input_rows_count); for (size_t i = 0; i < input_rows_count; ++i) { auto array_size = num->get_int(i); - if (UNLIKELY(array_size < 0)) { - return Status::RuntimeError("Array size can not be negative in function:" + - get_name()); + if (UNLIKELY(array_size < 0) || UNLIKELY(array_size > max_array_size_as_field)) { + return Status::RuntimeError("Array size should in range(0, {}) in function: {}", + max_array_size_as_field, get_name()); } offset += array_size; offsets.push_back(offset);