hubgeter commented on code in PR #40695:
URL: https://github.com/apache/doris/pull/40695#discussion_r1756585201


##########
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:
   i will use static const to  fix it.



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

Reply via email to