zclllyybb commented on code in PR #40567: URL: https://github.com/apache/doris/pull/40567#discussion_r1756011911
########## be/src/vec/functions/math.cpp: ########## @@ -350,6 +356,40 @@ struct PowName { }; using FunctionPow = FunctionBinaryArithmetic<PowImpl, PowName, false>; +class FunctionIsNan : public IFunction { +public: + static constexpr auto name = "is_nan"; + static FunctionPtr create() { return std::make_shared<FunctionIsNan>(); } + String get_name() const override { return name; } + size_t get_number_of_arguments() const override { return 1; } + bool is_variadic() const override { return false; } + + DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { + return std::make_shared<DataTypeBool>(); + } + + Status execute_impl(FunctionContext* context, Block& block, + Review Comment: remove the empty line ########## be/src/vec/functions/function_string.h: ########## @@ -4049,4 +4097,71 @@ class FunctionNgramSearch : public IFunction { } }; +class FunctionTranslate : public IFunction { +public: + static constexpr auto name = "translate"; + static FunctionPtr create() { return std::make_shared<FunctionTranslate>(); } + String get_name() const override { return name; } + size_t get_number_of_arguments() const override { return 3; } + + DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { + return std::make_shared<DataTypeString>(); + }; + + DataTypes get_variadic_argument_types_impl() const override { + return {std::make_shared<DataTypeString>(), std::make_shared<DataTypeString>(), + std::make_shared<DataTypeString>()}; + } + + Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, + size_t result, size_t input_rows_count) const override { + // We need a local variable to hold a reference to the converted column. + // So that the converted column will not be released before we use it. + auto col_source = + block.get_by_position(arguments[0]).column->convert_to_full_column_if_const(); Review Comment: better not use this. see what we deal the function with parameter columns in https://selectdb.feishu.cn/wiki/Rfwdw6VZCiQbAckxFHDcpKqknUf?from=from_copylink -- 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