Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(agg): comment out bad row count panic #14232

Merged
merged 5 commits into from
Dec 28, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/stream/src/executor/aggregation/agg_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,22 @@ impl<S: StateStore, Strtg: Strategy> AggGroup<S, Strtg> {
self.states[self.row_count_index],
AggState::Value(ref state) => state
);
let row_count = *row_count_state
let mut row_count = *row_count_state
.as_datum()
.as_ref()
.expect("row count state should not be NULL")
.as_int64();
if row_count < 0 {
tracing::error!(group = ?self.group_key_row(), "bad row count");
panic!("row count should be non-negative")
// panic!("row count should be non-negative") // TODO: need strict mode sys param / session var

// NOTE: Here is the case that an inconsistent `DELETE` arrives at HashAgg executor, and there's no
// corresponding group existing before (or has been deleted). In this case, `prev_row_count()` will
// report `0`. To ignore the inconsistent, we set `curr_row_count` to `0` here, so that `OnlyOutputIfHasInput`
// will return no change, so that the inconsistent will be hidden from downstream. This won't prevent from
// incorrect results of existing groups, but at least can prevent from downstream panicking due to non-existing
// keys.
stdrc marked this conversation as resolved.
Show resolved Hide resolved
row_count = 0;
stdrc marked this conversation as resolved.
Show resolved Hide resolved
}
row_count.try_into().unwrap()
}
Expand Down
Loading