HappenLee commented on code in PR #16159:
URL: https://github.com/apache/doris/pull/16159#discussion_r1089911392


##########
be/src/vec/functions/function_date_or_datetime_to_something.h:
##########
@@ -82,11 +83,21 @@ class FunctionDateOrDateTimeToSomething : public IFunction {
                     get_name(), arguments.size());
         }
 
-        return make_nullable(std::make_shared<ToDataType>());
+        bool is_nullable = false;
+        bool is_datev2 = false;
+        for (auto it : arguments) {
+            is_nullable = is_nullable || it.type->is_nullable();

Review Comment:
   ```
           bool is_nullable = false;
           bool is_datev2 = false;
           for (auto it : arguments) {
               is_nullable = is_nullable || it.type->is_nullable();
               is_datev2 = is_datev2 || 
WhichDataType(remove_nullable(it.type)).is_date_v2() ||
                           
WhichDataType(remove_nullable(it.type)).is_date_time_v2();
           }
   
           return is_nullable || !is_datev2 ? 
make_nullable(std::make_shared<ToDataType>())
                                            : std::make_shared<ToDataType>();
   ```
   the code better simple to a template function?



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

Reply via email to