MCPcopy Create free account
hub / github.com/apache/datafusion / nullif_int32

Function nullif_int32

datafusion/functions/src/core/nullif.rs:165–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163
164 #[test]
165 fn nullif_int32() -> Result<()> {
166 let a = Int32Array::from(vec![
167 Some(1),
168 Some(2),
169 None,
170 None,
171 Some(3),
172 None,
173 None,
174 Some(4),
175 Some(5),
176 ]);
177 let a = ColumnarValue::Array(Arc::new(a));
178
179 let lit_array = ColumnarValue::Scalar(ScalarValue::Int32(Some(2i32)));
180
181 let result = nullif_func(&[a, lit_array])?;
182 let result = result.into_array(0).expect("Failed to convert to array");
183
184 let expected = Arc::new(Int32Array::from(vec![
185 Some(1),
186 None,
187 None,
188 None,
189 Some(3),
190 None,
191 None,
192 Some(4),
193 Some(5),
194 ])) as ArrayRef;
195 assert_eq!(expected.as_ref(), result.as_ref());
196 Ok(())
197 }
198
199 #[test]
200 // Ensure that arrays with no nulls can also invoke NULLIF() correctly

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
nullif_funcFunction · 0.85
into_arrayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…