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

Function nullif_string

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

Source from the content-addressed store, hash-verified

241
242 #[test]
243 fn nullif_string() -> Result<()> {
244 let a = StringArray::from(vec![Some("foo"), Some("bar"), None, Some("baz")]);
245 let a = ColumnarValue::Array(Arc::new(a));
246
247 let lit_array = ColumnarValue::Scalar(ScalarValue::from("bar"));
248
249 let result = nullif_func(&[a, lit_array])?;
250 let result = result.into_array(0).expect("Failed to convert to array");
251
252 let expected = Arc::new(StringArray::from(vec![
253 Some("foo"),
254 None,
255 None,
256 Some("baz"),
257 ])) as ArrayRef;
258
259 assert_eq!(expected.as_ref(), result.as_ref());
260 Ok(())
261 }
262
263 #[test]
264 fn nullif_struct() -> Result<()> {

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…