github-actions[bot] commented on code in PR #67064:
URL: https://github.com/apache/doris/pull/67064#discussion_r3850353141
##########
be/src/exprs/function/cast/cast_to_datetimev2_impl.hpp:
##########
@@ -651,18 +651,20 @@ inline bool
CastToDatetimeV2::from_string_strict_mode_internal(
SET_PARAMS_RET_FALSE_IFN((consume_digit<UInt32, 2>(ptr, end,
part[0])),
"invalid hour offset '{}'",
std::string {ptr, end});
}
- SET_PARAMS_RET_FALSE_IFN(part[0] <= 14, "invalid hour offset
'{}'", part[0]);
+ const uint32_t max_hour_offset = sign == '-' ? 12 : 14;
+ SET_PARAMS_RET_FALSE_IFN(part[0] <= max_hour_offset, "invalid hour
offset '{}'",
+ part[0]);
if (ptr < end) {
if (*ptr == ':') {
++ptr;
}
// minute
SET_PARAMS_RET_FALSE_IFN((consume_digit<UInt32, 2>(ptr, end,
part[1])),
"invalid minute offset '{}'",
std::string {ptr, end});
- SET_PARAMS_RET_FALSE_IFN((part[1] == 0 || part[1] == 30 ||
part[1] == 45),
- "invalid minute offset '{}'",
part[1]);
+ SET_PARAMS_RET_FALSE_IFN(part[1] < 60, "invalid minute offset
'{}'", part[1]);
Review Comment:
[P1] Keep datetime CAST on one tested offset contract
The live PR body and [official datetime CAST
contract](https://doris.apache.org/zh-CN/docs/dev/sql-manual/basic-element/sql-data-types/conversion/datetime-conversion/)
define `[-14:00,+14:00]` with minutes `00/30/45`, but these six branches now
implement the generic zone policy `[-12:00,+14:00]` with arbitrary minutes.
This cannot pass the current suites: unchanged BE unit and
`cast_p0/cast_to_datetime` regression cases require `+08:25` to return `NULL`,
while `StringLikeLiteral`'s strict, compact, and non-strict patterns still
require `00|30|45`, so both new `+08:17` FE success assertions fail and folding
disagrees with BE runtime. Please choose one CAST contract and apply it
atomically through a CAST-local validator/resolver, all six BE branches, every
FE grammar, and the tests, without widening generic session-timezone lookup. If
the documented contract remains authoritative, retain the symmetric 14-hour
bound and `00/30/45` minutes.
--
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]