HappenLee commented on code in PR #17830:
URL: https://github.com/apache/doris/pull/17830#discussion_r1137284253


##########
be/src/vec/functions/function.cpp:
##########
@@ -138,53 +138,51 @@ bool allArgumentsAreConstants(const Block& block, const 
ColumnNumbers& args) {
 }
 } // namespace
 
+inline Status PreparedFunctionImpl::_execute_skipped_constant_deal(
+        FunctionContext* context, Block& block, const ColumnNumbers& args, 
size_t result,
+        size_t input_rows_count, bool dry_run) {
+    bool executed = false;
+    RETURN_IF_ERROR(default_implementation_for_nulls(context, block, args, 
result, input_rows_count,
+                                                     dry_run, &executed));
+    if (executed) {
+        return Status::OK();
+    }
+
+    if (dry_run) {
+        return execute_impl_dry_run(context, block, args, result, 
input_rows_count);
+    } else {
+        return execute_impl(context, block, args, result, input_rows_count);
+    }
+}
+
 Status PreparedFunctionImpl::default_implementation_for_constant_arguments(
         FunctionContext* context, Block& block, const ColumnNumbers& args, 
size_t result,
         size_t input_rows_count, bool dry_run, bool* executed) {
     *executed = false;
-    ColumnNumbers arguments_to_remain_constants = 
get_arguments_that_are_always_constant();
+    ColumnNumbers args_expect_const = get_arguments_that_are_always_constant();
 
-    /// Check that these arguments are really constant.
-    for (auto arg_num : arguments_to_remain_constants) {
+    // Check that these arguments are really constant.
+    for (auto arg_num : args_expect_const) {
         if (arg_num < args.size() &&
             !is_column_const(*block.get_by_position(args[arg_num]).column)) {
-            return Status::RuntimeError("Argument at index {} for function {}  
must be constant",
-                                        arg_num, get_name());
+            return Status::InvalidArgument("Argument at index {} for function 
{} must be constant",
+                                           arg_num, get_name());
         }
     }
 
     if (args.empty() || !use_default_implementation_for_constants() ||
         !allArgumentsAreConstants(block, args)) {
         return Status::OK();
     }
-
+    // now all columns is const.

Review Comment:
   change function `allArgumentsAreConstants` to `all_arguments_are_const`



-- 
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