linrrzqqq commented on code in PR #67397:
URL: https://github.com/apache/doris/pull/67397#discussion_r3925660726
##########
be/src/exprs/function/array/function_array_pop.cpp:
##########
@@ -104,9 +106,74 @@ class FunctionArrayPopfront : public
FunctionArrayPop<FunctionArrayPopfront> {
static constexpr int start_offset = 2;
};
+class FunctionArrayTrim : public IFunction {
+public:
+ static constexpr auto name = "trim_array";
+ static FunctionPtr create() { return
std::make_shared<FunctionArrayTrim>(); }
+
+ String get_name() const override { return name; }
+
+ bool is_variadic() const override { return false; }
+
+ size_t get_number_of_arguments() const override { return 2; }
+
+ DataTypePtr get_return_type_impl(const DataTypes& arguments) const
override {
+ DCHECK(arguments[0]->get_primitive_type() == TYPE_ARRAY)
+ << "First argument for function: " << name
+ << " should be DataTypeArray but it has type " <<
arguments[0]->get_name() << ".";
+ DCHECK(arguments[1]->get_primitive_type() == TYPE_BIGINT)
+ << "Second argument for function: " << name << " should be
BigInt but it has type "
+ << arguments[1]->get_name() << ".";
+ return arguments[0];
+ }
+
+ Status execute_impl(FunctionContext* context, Block& block, const
ColumnNumbers& arguments,
+ uint32_t result, size_t input_rows_count) const
override {
+ auto array_column =
+
block.get_by_position(arguments[0]).column->convert_to_full_column_if_const();
Review Comment:
use `unpack_if_const` and `index_check_const` better, you can refer to:
https://github.com/apache/doris/pull/64175
--
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]