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

Function spark_mod

datafusion/spark/src/function/math/modulus.rs:58–66  ·  view source on GitHub ↗

Spark-compatible `mod` function In ANSI mode, division by zero throws an error. In legacy mode, division by zero returns NULL (Spark behavior).

(
    args: &[ColumnarValue],
    enable_ansi_mode: bool,
)

Source from the content-addressed store, hash-verified

56/// In ANSI mode, division by zero throws an error.
57/// In legacy mode, division by zero returns NULL (Spark behavior).
58pub fn spark_mod(
59 args: &[ColumnarValue],
60 enable_ansi_mode: bool,
61) -> Result<ColumnarValue> {
62 assert_eq_or_internal_err!(args.len(), 2, "mod expects exactly two arguments");
63 let args = ColumnarValue::values_to_arrays(args)?;
64 let result = try_rem(&args[0], &args[1], enable_ansi_mode)?;
65 Ok(ColumnarValue::Array(result))
66}
67
68/// Spark-compatible `pmod` function
69/// In ANSI mode, division by zero throws an error.

Callers 9

invoke_with_argsMethod · 0.85
test_mod_int32Function · 0.85
test_mod_int64Function · 0.85
test_mod_float64Function · 0.85
test_mod_float32Function · 0.85
test_mod_scalarFunction · 0.85
test_mod_wrong_arg_countFunction · 0.85

Calls 2

values_to_arraysFunction · 0.85
try_remFunction · 0.85

Tested by 8

test_mod_int32Function · 0.68
test_mod_int64Function · 0.68
test_mod_float64Function · 0.68
test_mod_float32Function · 0.68
test_mod_scalarFunction · 0.68
test_mod_wrong_arg_countFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…