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


##########
be/src/vec/functions/function_cast.h:
##########
@@ -289,8 +285,16 @@ struct ConvertImpl {
                                              IsDateV2Type<ToDataType>) {
                             DataTypeDateTimeV2::cast_to_date_v2(vec_from[i], 
vec_to[i]);
                         } else {
-                            UInt32 scale = additions;
-                            vec_to[i] = ToFieldType(vec_from[i] / std::pow(10, 
6 - scale));
+                            UInt32 to_scale = additions;
+                            DateV2Value<DateTimeV2ValueType> value =
+                                    binary_cast<FromFieldType, 
DateV2Value<DateTimeV2ValueType>>(
+                                            vec_from[i]);
+                            // scale reduce to 4, means the last 2 digits are 
0.
+                            
static_cast<void>(value.set_time_unit<TimeUnit::MICROSECOND>(

Review Comment:
   better use bit op to speed up the cast



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