HappenLee commented on code in PR #17973:
URL: https://github.com/apache/doris/pull/17973#discussion_r1142379729
##########
be/src/vec/exprs/table_function/vexplode_numbers.cpp:
##########
@@ -35,7 +37,15 @@ Status
VExplodeNumbersTableFunction::process_init(vectorized::Block* block) {
RETURN_IF_ERROR(_vexpr_context->root()->children()[0]->execute(_vexpr_context,
block,
&value_column_idx));
_value_column = block->get_by_position(value_column_idx).column;
-
+ if (is_column_const(*_value_column)) {
+ int value = *reinterpret_cast<const
int*>(_value_column->get_data_at(0).data);
+ if (value <= block->rows()) { // use const optimize
+ _is_const = true;
+ for (int i = 1; i <= value; i++) {
+ ((ColumnInt32*)_elements_column.get())->insert_value(i);
Review Comment:
better resize and call std::iota or std::generate to do the work
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]