Skip to content

Commit 18dcc75

Browse files
authored
fix: only validate non-null decimals (#5745)
Signed-off-by: Alexander Droste <[email protected]>
1 parent 8ebf37a commit 18dcc75

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

vortex-vector/src/decimal/generic.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,17 @@ impl<D: NativeDecimalType> DVector<D> {
9696
);
9797
}
9898

99-
// We assert that each element is within bounds for the given precision/scale.
100-
if let Some(invalid) = elements.iter().find(|e| !ps.is_valid(**e)) {
101-
vortex_bail!(
102-
"One or more elements (e.g. {invalid}) are out of bounds for precision {} and scale {}",
103-
ps.precision(),
104-
ps.scale(),
105-
);
99+
// TODO(0ax1): iteration based on mask density via threshold_iter
100+
101+
// We assert that each non-null element is within bounds for the given precision/scale.
102+
for (element, is_valid) in elements.iter().zip(validity.to_bit_buffer().iter()) {
103+
if is_valid && !ps.is_valid(*element) {
104+
vortex_bail!(
105+
"One or more elements (e.g. {element}) are out of bounds for precision {} and scale {}",
106+
ps.precision(),
107+
ps.scale(),
108+
);
109+
}
106110
}
107111

108112
Ok(Self {

0 commit comments

Comments
 (0)