github-actions[bot] commented on code in PR #67500:
URL: https://github.com/apache/doris/pull/67500#discussion_r3943985401


##########
be/src/exprs/function/cast/cast_to_time_impl.hpp:
##########
@@ -72,6 +72,8 @@ template <DatelikeParseMode ParseMode>
         }
         val = TimeValue::init_microsecond(
                 val, sign * in_scale_part * common::exp10_i32(6 - 
(int)target_scale));
+        SET_PARAMS_RET_FALSE_IFN(TimeValue::valid(val),

Review Comment:
   [P1] Preserve wide decimal fractions before validating
   
   `from_decimal<T>` narrows `frac_part` to `int64_t` before this new check, 
although the SerDe instantiates this path for Decimal128/256. For 
`CAST(CAST('8385959.000001' AS DECIMAL(32,25)) AS TIME(6))`, the native 
remainder is `10^19`; on this target the narrowing makes it negative. 
`init_microsecond` then subtracts one microsecond from the positive endpoint 
and returns non-NULL `838:59:58.999999`; the negative input similarly becomes 
`-838:59:58.999999`. Both corrupted values pass `valid(val)`, including strict 
mode. Please retain the decimal-native width while scaling/rounding, narrow 
only the proven-small microsecond result, and cover both signs for 
Decimal128/256. This is distinct from the earlier post-assembly thread: its 
Decimal64 case is fixed, while this path corrupts the fraction before 
validation.



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