fix: batter

This commit is contained in:
skyoct 2024-04-21 12:01:31 +00:00
parent 5d36d1aa4e
commit 2f6db2ac47

View File

@ -42,12 +42,13 @@ public:
Columns converted_columns(arg_size); Columns converted_columns(arg_size);
for (size_t arg = 0; arg < arg_size; ++arg) for (size_t arg = 0; arg < arg_size; ++arg)
converted_columns[arg] = castColumn(arguments[arg], result_type)->convertToFullColumnIfConst(); converted_columns[arg] = castColumn(arguments[arg], result_type)->convertToFullColumnIfConst();
if (converted_columns[1]->compareAt(0, 0, *converted_columns[2], 1) > 0)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Function {} the minimum value cannot be greater than the maximum value", getName());
auto result_column = result_type->createColumn(); auto result_column = result_type->createColumn();
for (size_t row_num = 0; row_num < input_rows_count; ++row_num) for (size_t row_num = 0; row_num < input_rows_count; ++row_num)
{ {
if (converted_columns[1]->compareAt(row_num, row_num, *converted_columns[2], 1) > 0)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Function {} the minimum value cannot be greater than the maximum value", getName());
size_t best_arg = 0; size_t best_arg = 0;
if (converted_columns[1]->compareAt(row_num, row_num, *converted_columns[best_arg], 1) > 0) if (converted_columns[1]->compareAt(row_num, row_num, *converted_columns[best_arg], 1) > 0)
best_arg = 1; best_arg = 1;