superdiaodiao commented on code in PR #40695: URL: https://github.com/apache/doris/pull/40695#discussion_r1755997224
########## be/src/vec/functions/math.cpp: ########## @@ -350,6 +350,70 @@ struct PowName { }; using FunctionPow = FunctionBinaryArithmetic<PowImpl, PowName, false>; +class FunctionNormalCdf : public IFunction { +public: + static constexpr auto name = "normal_cdf"; + String get_name() const override { return name; } + static FunctionPtr create() { return std::make_shared<FunctionNormalCdf>(); } + DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { + return make_nullable(std::make_shared<DataTypeFloat64>()); + } + DataTypes get_variadic_argument_types_impl() const override { + return {std::make_shared<DataTypeFloat64>(), std::make_shared<DataTypeFloat64>(), + std::make_shared<DataTypeFloat64>()}; + } + size_t get_number_of_arguments() const override { return 3; } Review Comment: better add blank line between functions/variables ########## be/src/vec/functions/function_timestamp.cpp: ########## @@ -1182,6 +1184,139 @@ class FunctionOtherTypesToDateType : public IFunction { } }; +struct FromIso8601DateV2 { + static constexpr auto name = "from_iso8601_date"; + + static bool is_variadic() { return true; } //todo : check is or not is_variadic + + static DataTypes get_variadic_argument_types() { return {std::make_shared<DataTypeString>()}; } + + static DataTypePtr get_return_type_impl(const DataTypes& arguments) { + return make_nullable(std::make_shared<DataTypeDateV2>()); + } + + static Status execute(FunctionContext* context, Block& block, const ColumnNumbers& arguments, + size_t result, size_t input_rows_count) { + const auto* src_column_ptr = block.get_by_position(arguments[0]).column.get(); + + std::regex calendar_regex(R"((\d{4})(-)?(\d{2})(-)?(\d{2}))"); // YYYY-MM-DD or YYYYMMDD + std::regex year_month_regex(R"((\d{4})-(\d{2}))"); // YYYY-MM + std::regex year_only_regex(R"((\d{4}))"); // YYYY + std::regex week_regex( + R"((\d{4})(-)?W(\d{2})(-)?(\d)?)"); // YYYY-Www or YYYY-Www-D or YYYYWww or YYYYWwwD + std::regex day_of_year_regex(R"((\d{4})(-)?(\d{3}))"); // YYYY-DDD or YYYYDDD Review Comment: Consider add `const` for them and move outside of `execute()` to improve the efficiency. -- 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