Skip to content

Commit 7bd97d7

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

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/expr/src/relation/func.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3943,7 +3943,16 @@ 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 {
3955+
// TODO(ggevay): Add count to error msg after the old subquery code is gone.
39473956
Err(EvalError::MultipleRowsFromSubquery)
39483957
} else {
39493958
Ok(Box::new([].into_iter()))

0 commit comments

Comments
 (0)