jacktengg commented on code in PR #67823:
URL: https://github.com/apache/doris/pull/67823#discussion_r3999988200
##########
be/src/exprs/aggregate/aggregate_function_window_funnel_v2.h:
##########
@@ -261,7 +261,11 @@ struct WindowFunnelStateV2 {
} else {
DateValueType end_ts = _ts_from_int(base_ts);
TimeInterval interval(SECOND, window, false);
- end_ts.template date_add_interval<SECOND>(interval);
+ if (!end_ts.template date_add_interval<SECOND>(interval)) {
Review Comment:
建议改为比较实际微秒差
可以复用已有的 datetime_diff_in_microseconds()
(be/src/core/value/vdatetime_value.h:1274):
const auto base = _ts_from_int(base_ts);
const auto current = _ts_from_int(current_ts);
return
static_cast<__int128>(current.datetime_diff_in_microseconds(base)) <=
static_cast<__int128>(window) * 1000000;
这样不必构造可能超出日期上限的窗口终点,同时保留微秒精度。不能直接对 DATETIMEV2
的原始整数做减法,因为它是日期字段的位打包编码;也不宜用截断到整秒的差
值,否则 1.000001 秒可能误入 1 秒窗口。
另外,V1 的日期加法路径
(be/src/exprs/aggregate/aggregate_function_window_funnel.h:194) 也忽略了同类返回值。现有 V2
单测包含纳秒上界用例,但未发现上述
DATETIMEV2 越界覆盖,建议补充该反例、恰好到窗口终点、超出 1 微秒及超大窗口用例。
--
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]