Copilot commented on code in PR #62179:
URL: https://github.com/apache/doris/pull/62179#discussion_r3059586243
##########
be/src/exprs/aggregate/aggregate_function_sequence_match.h:
##########
@@ -256,7 +256,12 @@ struct AggregateFunctionSequenceMatchData final {
NativeType duration = 0;
const auto* prev_pos = pos;
- pos = try_read_first_int_text(duration, pos, end);
+ StringParser::ParseResult result;
+ duration =
+ StringParser::string_to_int<NativeType,
false>(pos, end - pos, &result);
+ while (pos < end && *pos >= '0' && *pos <= '9') {
+ ++pos;
+ }
Review Comment:
`StringParser::string_to_int` is called with `end - pos` (the rest of the
pattern), but then `pos` is advanced only over the leading digits. This can
cause parsing to fail when the number is immediately followed by non-digit
characters (e.g. ")"), leaving `duration` as an unspecified/incorrect value
while `pos != prev_pos` so no error is reported. Parse using the digit-only
slice (`[prev_pos, digit_end)`) and check the parse result (or at least silence
the unused `result` variable).
##########
be/src/exprs/aggregate/aggregate_function_sequence_match.h:
##########
@@ -275,7 +280,12 @@ struct AggregateFunctionSequenceMatchData final {
} else {
UInt64 event_number = 0;
const auto* prev_pos = pos;
- pos = try_read_first_int_text(event_number, pos, end);
+ StringParser::ParseResult result;
+ event_number =
+ StringParser::string_to_int<UInt64, false>(pos,
end - pos, &result);
+ while (pos < end && *pos >= '0' && *pos <= '9') {
+ ++pos;
+ }
Review Comment:
Same issue as the duration parsing above: `string_to_int` uses `end - pos`
(including trailing pattern chars), but `pos` is later advanced only over
digits. This can make `event_number` parse fail while still consuming digits,
producing an incorrect `event_number` without triggering the `pos == prev_pos`
check. Parse using the digit-only substring and check (or explicitly ignore)
the parse result.
--
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]