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

Function test_mod_int32

datafusion/spark/src/function/math/modulus.rs:189–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187
188 #[test]
189 fn test_mod_int32() {
190 let left = Int32Array::from(vec![Some(10), Some(7), Some(15), None]);
191 let right = Int32Array::from(vec![Some(3), Some(2), Some(4), Some(5)]);
192
193 let left_value = ColumnarValue::Array(Arc::new(left));
194 let right_value = ColumnarValue::Array(Arc::new(right));
195
196 let result = spark_mod(&[left_value, right_value], false).unwrap();
197
198 if let ColumnarValue::Array(result_array) = result {
199 let result_int32 =
200 result_array.as_any().downcast_ref::<Int32Array>().unwrap();
201 assert_eq!(result_int32.value(0), 1); // 10 % 3 = 1
202 assert_eq!(result_int32.value(1), 1); // 7 % 2 = 1
203 assert_eq!(result_int32.value(2), 3); // 15 % 4 = 3
204 assert!(result_int32.is_null(3)); // None % 5 = None
205 } else {
206 panic!("Expected array result");
207 }
208 }
209
210 #[test]
211 fn test_mod_int64() {

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
spark_modFunction · 0.85
as_anyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…