[fix](function) fix error when use negative number in explode_numbers #27020

This commit is contained in:
Mryange
2023-11-17 12:02:14 +08:00
committed by GitHub
parent 1188d88a10
commit 91af86bc78
3 changed files with 47 additions and 0 deletions

View File

@ -63,6 +63,8 @@ Status VExplodeNumbersTableFunction::process_init(Block* block, RuntimeState* st
_cur_size = column_nested->get_int(0);
}
((ColumnInt32*)_elements_column.get())->clear();
//_cur_size may be a negative number
_cur_size = std::max(0L, _cur_size);
if (_cur_size &&
_cur_size <= state->batch_size()) { // avoid elements_column too big or empty
_is_const = true; // use const optimize