zclllyybb commented on code in PR #17970: URL: https://github.com/apache/doris/pull/17970#discussion_r1147140160
########## be/src/vec/functions/function.cpp: ########## @@ -166,15 +166,24 @@ Status PreparedFunctionImpl::default_implementation_for_constant_arguments( !all_arguments_are_constant(block, args)) { return Status::OK(); } + // now all columns is const. Block temporary_block; size_t arguments_size = args.size(); for (size_t arg_num = 0; arg_num < arguments_size; ++arg_num) { const ColumnWithTypeAndName& column = block.get_by_position(args[arg_num]); - temporary_block.insert( - {assert_cast<const ColumnConst*>(column.column.get())->get_data_column_ptr(), - column.type, column.name}); + // Columns in const_list --> column_const, others --> nested_column + // that's because some functions supposes some specific columns always constant. + // If we unpack it, there will be unnecessary cost of virtual judge. + if (args_expect_const.end() != + std::find(args_expect_const.begin(), args_expect_const.end(), arg_num)) { + temporary_block.insert({column.column->clone_resized(1), column.type, column.name}); Review Comment: That's ok to remove it. done. -- 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