github-actions[bot] commented on code in PR #63003:
URL: https://github.com/apache/doris/pull/63003#discussion_r3206202224
##########
be/src/exprs/function/function_date_or_datetime_to_something.h:
##########
@@ -37,13 +37,17 @@ struct Transformer {
vec_to.resize(size);
for (size_t i = 0; i < size; ++i) {
- //FIXME: seems external table still generates invalid
date/datetime. but where?
+ // Only check in debug mode. for external table there's risk to
write an invalid datetime. use this to find it.
+ // Not checked in RELEASE mode for performance considerations
+#ifndef NDEBUG
if (!vec_from[i].is_valid_date()) [[unlikely]] {
char buf[64];
vec_from[i].to_string(buf);
throw Exception(ErrorCode::INVALID_ARGUMENT, "Operation {}
meets invalid data: {}",
Transform::name, buf);
}
+#endif
Review Comment:
This makes production builds silently continue on invalid date/datetime
values. The comment still says external tables can write invalid datetime data,
and external native timestamp readers can materialize values with unchecked
setters before this common transform path runs. For example, Parquet
`Int64ToTimestamp` and ORC `_decode_time_column` call `from_unixtime(...)`,
whose hot-path implementation uses `unchecked_set_time(...)` without validating
the resulting year/month/day. Before this change, `year(ts)`, `month(ts)`,
`to_date(ts)`, etc. failed with `INVALID_ARGUMENT`; with `NDEBUG` they execute
`Transform::execute` on invalid bitfields and can return silently corrupted
results. Please either keep a release-mode failure path here or move equivalent
validation to the scan/conversion boundary so invalid external datetime data
cannot reach these transforms.
--
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]