Skip to content

Commit 9558efa

Browse files
committed
Soft assert that the count in GuardSubquerySize is >=1
1 parent 215b7d4 commit 9558efa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/expr/src/relation/func.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3943,6 +3943,14 @@ impl TableFunc {
39433943
// We error if the count is not one,
39443944
// and produce no rows if equal to one.
39453945
let count = datums[0].unwrap_int64();
3946+
// Note that we can't get a 0 count here, since the `Reduce count` below us is not
3947+
// an SQL `count`, but an MIR `count`, which has an empty output on an empty input.
3948+
// If we get a negative count, then we have a negative accumulation error somewhere.
3949+
soft_assert_or_log!(
3950+
count >= 1,
3951+
"GuardSubquerySize encountered invalid count: {}",
3952+
count
3953+
);
39463954
if count != 1 {
39473955
Err(EvalError::MultipleRowsFromSubquery)
39483956
} else {

0 commit comments

Comments
 (0)