HappenLee commented on a change in pull request #8238:
URL: https://github.com/apache/incubator-doris/pull/8238#discussion_r815556429



##########
File path: be/src/vec/functions/function_timestamp.cpp
##########
@@ -52,8 +52,60 @@ struct StrToDate {
             if (!ts_val.from_date_format_str(r_raw_str, r_str_size, l_raw_str, 
l_str_size)) {
                 null_map[i] = 1;
             }
-            ts_val.to_datetime();
+            if (context->impl()->get_return_type().type ==
+                doris_udf::FunctionContext::Type::TYPE_DATETIME) {
+                ts_val.to_datetime();
+            } else {
+                ts_val.cast_to_date();
+            }
+        }
+    }
+};
+
+template <typename Impl>
+class FunctionStrToDateOrDateTime : public IFunction {

Review comment:
       should change other function of `FunctionBinaryStringOperateToNullType` 
and add `FunctionContext`




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