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

Function test_pmod_int32

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

Source from the content-addressed store, hash-verified

421 // PMOD tests
422 #[test]
423 fn test_pmod_int32() {
424 let left = Int32Array::from(vec![Some(10), Some(-7), Some(15), Some(-15), None]);
425 let right = Int32Array::from(vec![Some(3), Some(3), Some(4), Some(4), Some(5)]);
426
427 let left_value = ColumnarValue::Array(Arc::new(left));
428 let right_value = ColumnarValue::Array(Arc::new(right));
429
430 let result = spark_pmod(&[left_value, right_value], false).unwrap();
431
432 if let ColumnarValue::Array(result_array) = result {
433 let result_int32 =
434 result_array.as_any().downcast_ref::<Int32Array>().unwrap();
435 assert_eq!(result_int32.value(0), 1); // 10 pmod 3 = 1
436 assert_eq!(result_int32.value(1), 2); // -7 pmod 3 = 2 (positive remainder)
437 assert_eq!(result_int32.value(2), 3); // 15 pmod 4 = 3
438 assert_eq!(result_int32.value(3), 1); // -15 pmod 4 = 1 (positive remainder)
439 assert!(result_int32.is_null(4)); // None pmod 5 = None
440 } else {
441 panic!("Expected array result");
442 }
443 }
444
445 #[test]
446 fn test_pmod_int64() {

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…