Skip to content

Commit c64ec4f

Browse files
committed
fix: only validate non-null decimals
Signed-off-by: Alexander Droste <[email protected]>
1 parent bdcba32 commit c64ec4f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

vortex-vector/src/decimal/generic.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ 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+
// We assert that each non-null element is within bounds for the given precision/scale.
100+
for (idx, element) in elements.iter().enumerate() {
101+
if validity.value(idx) && !ps.is_valid(*element) {
102+
vortex_bail!(
103+
"One or more elements (e.g. {element}) are out of bounds for precision {} and scale {}",
104+
ps.precision(),
105+
ps.scale(),
106+
);
107+
}
106108
}
107109

108110
Ok(Self {

0 commit comments

Comments
 (0)