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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to