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

Function test_mod_int64

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

Source from the content-addressed store, hash-verified

209
210 #[test]
211 fn test_mod_int64() {
212 let left = Int64Array::from(vec![Some(100), Some(50), Some(200)]);
213 let right = Int64Array::from(vec![Some(30), Some(25), Some(60)]);
214
215 let left_value = ColumnarValue::Array(Arc::new(left));
216 let right_value = ColumnarValue::Array(Arc::new(right));
217
218 let result = spark_mod(&[left_value, right_value], false).unwrap();
219
220 if let ColumnarValue::Array(result_array) = result {
221 let result_int64 =
222 result_array.as_any().downcast_ref::<Int64Array>().unwrap();
223 assert_eq!(result_int64.value(0), 10); // 100 % 30 = 10
224 assert_eq!(result_int64.value(1), 0); // 50 % 25 = 0
225 assert_eq!(result_int64.value(2), 20); // 200 % 60 = 20
226 } else {
227 panic!("Expected array result");
228 }
229 }
230
231 #[test]
232 fn test_mod_float64() {

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…