Skip to content

Commit ea106e4

Browse files
fix[scalar_fns]: add correct pre-condition checks for all custom pushdown (#6977)
Check the fill null value Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent 9a9a3ce commit ea106e4

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

vortex-array/src/scalar_fn/fns/fill_null/kernel.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use vortex_error::VortexExpect;
55
use vortex_error::VortexResult;
6+
use vortex_error::vortex_ensure;
67

78
use crate::ArrayRef;
89
use crate::ExecutionCtx;
@@ -57,6 +58,11 @@ pub(super) fn precondition(
5758
array: &ArrayRef,
5859
fill_value: &Scalar,
5960
) -> VortexResult<Option<ArrayRef>> {
61+
vortex_ensure!(
62+
!fill_value.is_null(),
63+
"fill_null requires a non-null fill value"
64+
);
65+
6066
// If the array has no nulls, fill_null is a no-op (just cast for nullability).
6167
if !array.dtype().is_nullable() || array.all_valid()? {
6268
return array.to_array().cast(fill_value.dtype().clone()).map(Some);

vortex-array/src/scalar_fn/fns/fill_null/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ impl ScalarFnVTable for FillNull {
105105
.as_constant()
106106
.ok_or_else(|| vortex_err!("fill_null fill_value must be a constant/scalar"))?;
107107

108+
vortex_ensure!(
109+
!fill_scalar.is_null(),
110+
"fill_null requires a non-null fill value"
111+
);
112+
108113
let Some(columnar) = input.as_opt::<AnyColumnar>() else {
109114
return input.execute::<ArrayRef>(ctx)?.fill_null(fill_scalar);
110115
};

0 commit comments

Comments
 (0)