MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_nullif_int_array_offset

Function test_nullif_int_array_offset

arrow-select/src/nullif.rs:167–191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165
166 #[test]
167 fn test_nullif_int_array_offset() {
168 let a = Int32Array::from(vec![None, Some(15), Some(8), Some(1), Some(9)]);
169 let a = a.slice(1, 3); // Some(15), Some(8), Some(1)
170 let a = a.as_any().downcast_ref::<Int32Array>().unwrap();
171 let comp = BooleanArray::from(vec![
172 Some(false),
173 Some(false),
174 Some(false),
175 None,
176 Some(true),
177 Some(false),
178 None,
179 ]);
180 let comp = comp.slice(2, 3); // Some(false), None, Some(true)
181 let comp = comp.as_any().downcast_ref::<BooleanArray>().unwrap();
182 let res = nullif(a, comp).unwrap();
183
184 let expected = Int32Array::from(vec![
185 Some(15), // False => keep it
186 Some(8), // None => keep it
187 None, // true => None
188 ]);
189 let res = res.as_primitive::<Int32Type>();
190 assert_eq!(&expected, res)
191 }
192
193 #[test]
194 fn test_nullif_string() {

Callers

nothing calls this directly

Calls 3

nullifFunction · 0.85
sliceMethod · 0.45
as_anyMethod · 0.45

Tested by

no test coverage detected