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

Function nullif_list

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

Source from the content-addressed store, hash-verified

307
308 #[test]
309 fn nullif_list() -> Result<()> {
310 let lhs = Arc::new(ListArray::from_iter_primitive::<Int64Type, _, _>(vec![
311 Some(vec![Some(1), Some(2)]),
312 Some(vec![Some(3)]),
313 Some(vec![]),
314 Some(vec![Some(5), Some(6), Some(7)]),
315 None,
316 ]));
317 let lhs = ColumnarValue::Array(lhs);
318
319 let rhs = Arc::new(ListArray::from_iter_primitive::<Int64Type, _, _>(vec![
320 Some(vec![Some(1), Some(2)]),
321 ]));
322 let rhs = ColumnarValue::Scalar(ScalarValue::List(rhs));
323
324 let result = nullif_func(&[lhs, rhs])?;
325 let result = result.into_array(0).expect("Failed to convert to array");
326
327 let expected = Arc::new(ListArray::from_iter_primitive::<Int64Type, _, _>(vec![
328 None,
329 Some(vec![Some(3)]),
330 Some(vec![]),
331 Some(vec![Some(5), Some(6), Some(7)]),
332 None,
333 ])) as ArrayRef;
334
335 assert_eq!(expected.as_ref(), result.as_ref());
336
337 Ok(())
338 }
339
340 #[test]
341 fn nullif_compare_nested_to_unnested() -> Result<()> {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
nullif_funcFunction · 0.85
ListClass · 0.50
into_arrayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…