jacktengg commented on code in PR #67981:
URL: https://github.com/apache/doris/pull/67981#discussion_r4014551387
##########
be/src/exprs/function/cast/cast_to_int.h:
##########
@@ -72,6 +72,11 @@ class CastToImpl<CastMode, FromDataType, ToDataType> :
public CastToBase {
CastParameters params;
params.is_strict = (CastMode == CastModeType::StrictMode);
for (size_t i = 0; i < input_rows_count; ++i) {
+ // The source value of a row marked as null by the input null map
is a hidden
+ // payload and has no SQL semantics, so it must not be checked.
+ if (null_map && null_map[i]) {
+ continue;
Review Comment:
评论事实核心成立(跳过的目标槽确实未初始化,而且确实有下游消费者会读它),但它描述的"用户可见后果"没能复现:垃圾值最终都被 NULL map
掩盖。严重性更像"UB/健壮性隐患",不是当前能复现的错误结果。
原因有三条:
1. 每层 CAST 都会用 wrap_in_nullable 把源列 NULL map 合并进结果(be/src/exprs/function/
function.cpp:45),所以乱码只活在中间列;
2. 分组/比较/序列化都不看 NULL 行的嵌套值(ColumnNullable::update_hash_with_value 对 NULL
行直接
hash.update(0),be/src/core/column/column_nullable.cpp:155);
3. 日期格式化路径本来就为这个场景做了保护:DateV2Value::to_buffer 对非法日期写空串,注释里还专门写了
cast(cast(null_date as char) as
date)(be/src/core/value/vdatetime_value.cpp:2261)。另外
TIMESTAMP_NS 的 int64 纳秒最多只能表示 1970±292 年,必然落在 DateV2 合法 daynr 范围内,
to_datetime() 里的 DCHECK(valid) 也不会触发(Debug/ASAN 构建同样不会崩)。
--
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]