Skip to content

Commit 34dd017

Browse files
committed
flag_offset
1 parent 44b38e1 commit 34dd017

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/query/functions/src/aggregates/adaptors/aggregate_null_adaptor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,5 +679,9 @@ fn get_flag(place: AggrState) -> bool {
679679
}
680680

681681
fn flag_offset(place: AggrState) -> usize {
682-
*place.loc.last().unwrap().as_bool().unwrap().1
682+
let n = place.loc.len();
683+
debug_assert!(n > 0);
684+
let loc = unsafe { place.loc.get_unchecked(n - 1) };
685+
debug_assert!(loc.is_bool());
686+
loc.offset()
683687
}

src/query/functions/src/aggregates/adaptors/aggregate_ornull_adaptor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ fn merge_flag(place: AggrState, other: bool) {
7373
}
7474

7575
fn flag_offset(place: AggrState) -> usize {
76-
*place.loc.last().unwrap().as_bool().unwrap().1
76+
let n = place.loc.len();
77+
debug_assert!(n > 0);
78+
let loc = unsafe { place.loc.get_unchecked(n - 1) };
79+
debug_assert!(loc.is_bool());
80+
loc.offset()
7781
}
7882

7983
impl AggregateFunction for AggregateFunctionOrNullAdaptor {

0 commit comments

Comments
 (0)