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

Function test_pmod_int64

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

Source from the content-addressed store, hash-verified

444
445 #[test]
446 fn test_pmod_int64() {
447 let left = Int64Array::from(vec![Some(100), Some(-50), Some(200), Some(-200)]);
448 let right = Int64Array::from(vec![Some(30), Some(30), Some(60), Some(60)]);
449
450 let left_value = ColumnarValue::Array(Arc::new(left));
451 let right_value = ColumnarValue::Array(Arc::new(right));
452
453 let result = spark_pmod(&[left_value, right_value], false).unwrap();
454
455 if let ColumnarValue::Array(result_array) = result {
456 let result_int64 =
457 result_array.as_any().downcast_ref::<Int64Array>().unwrap();
458 assert_eq!(result_int64.value(0), 10); // 100 pmod 30 = 10
459 assert_eq!(result_int64.value(1), 10); // -50 pmod 30 = 10 (positive remainder)
460 assert_eq!(result_int64.value(2), 20); // 200 pmod 60 = 20
461 assert_eq!(result_int64.value(3), 40); // -200 pmod 60 = 40 (positive remainder)
462 } else {
463 panic!("Expected array result");
464 }
465 }
466
467 #[test]
468 fn test_pmod_float64() {

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
spark_pmodFunction · 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…