diff --git a/dialects/cudf.yaml b/dialects/cudf.yaml index 421d49a3..6fd61f84 100644 --- a/dialects/cudf.yaml +++ b/dialects/cudf.yaml @@ -17,9 +17,11 @@ scalar_functions: overflow: SILENT # cudf rolls over on overflow rounding: TIE_TO_EVEN - name: divide - local_name: division + local_name: divide required_options: overflow: SILENT # cudf rolls over on overflow rounding: TIE_TO_EVEN on_division_by_zero: LIMIT on_domain_error: NAN + - name: modulus + local_name: mod diff --git a/dialects/datafusion.yaml b/dialects/datafusion.yaml index 918a146e..3e133b4c 100644 --- a/dialects/datafusion.yaml +++ b/dialects/datafusion.yaml @@ -25,7 +25,31 @@ scalar_functions: overflow: ERROR rounding: TIE_TO_EVEN - name: modulus - unsupported: true + unsupported_kernels: + - args: + - i8 + - i8 + result: i8 + - args: + - i16 + - i16 + result: i16 + - args: + - i32 + - i32 + result: i32 + - args: + - i64 + - i64 + result: i64 + - args: + - fp32 + - fp32 + result: fp32 + - args: + - fp64 + - fp64 + result: fp64 - name: power - name: sqrt required_options: diff --git a/dialects/duckdb.yaml b/dialects/duckdb.yaml index cf46083a..aa791115 100644 --- a/dialects/duckdb.yaml +++ b/dialects/duckdb.yaml @@ -29,9 +29,15 @@ scalar_functions: - name: modulus local_name: "%" infix: True - required_options: - overflow: ERROR - rounding: TIE_TO_EVEN + unsupported_kernels: + - args: + - fp32 + - fp32 + result: fp32 + - args: + - fp64 + - fp64 + result: fp64 - name: power required_options: overflow: ERROR diff --git a/dialects/postgres.yaml b/dialects/postgres.yaml index fa8df519..325d0805 100644 --- a/dialects/postgres.yaml +++ b/dialects/postgres.yaml @@ -67,8 +67,6 @@ scalar_functions: - name: modulus local_name: "%" infix: True - required_options: - overflow: ERROR unsupported_kernels: - args: - i8 diff --git a/dialects/sqlite.yaml b/dialects/sqlite.yaml index c879b5ed..6f9aef79 100644 --- a/dialects/sqlite.yaml +++ b/dialects/sqlite.yaml @@ -37,8 +37,6 @@ scalar_functions: - name: modulus local_name: "%" infix: True - required_options: - overflow: SILENT - name: power - name: sqrt required_options: diff --git a/dialects/velox_presto.yaml b/dialects/velox_presto.yaml index 25fdf2a6..86833902 100644 --- a/dialects/velox_presto.yaml +++ b/dialects/velox_presto.yaml @@ -98,8 +98,6 @@ scalar_functions: result: fp32 - name: modulus local_name: mod - required_options: - overflow: ERROR unsupported_kernels: - args: - i8 diff --git a/supplemental/arithmetic/modulus.md b/supplemental/arithmetic/modulus.md new file mode 100644 index 00000000..ab2020bf --- /dev/null +++ b/supplemental/arithmetic/modulus.md @@ -0,0 +1,43 @@ +# Modulus + +## Options +Not supported + +### Overflow + +Not supported + +### Rounding + +Not supported + +## Details + +### Overflow and rounding +The Modulus function will not require options such as Overflow or rounding +which are present in other arithmetic functions, because there will not be +an event in the allowed kernels and data type where the modulus function can +behave in one of such ways. Modulus function is defined for integer values only +and they do not operate on floating values. Thus, they cannot have floats as +remainders. Additionally, result of modulus on two operands will always result +a value within the range. + +### Not commutative + +Modulus as an arithmetic operation is not commutative by nature. + +## Properties + +### Null propagating + +If any of the inputs is null then the output will be null + +### NaN propagating + +If any of the inputs is NaN (and the other input is not null) then the output +will be NaN + +### Stateless + +The output will be the same regardless of the order of input rows. This is not +guaranteed to be true for integer division when overflow is SILENT.