Jefffrey commented on code in PR #24409:
URL: https://github.com/apache/datafusion/pull/24409#discussion_r3791793457


##########
datafusion/spark/src/function/math/modulus.rs:
##########
@@ -182,7 +304,7 @@ impl Default for SparkPmod {
 impl SparkPmod {
     pub fn new() -> Self {
         Self {
-            signature: Signature::numeric(2, Volatility::Immutable),
+            signature: Signature::user_defined(Volatility::Immutable),

Review Comment:
   would it be valid to do this instead:
   
   ```rust
               signature: Signature::one_of(
                   vec![
                       TypeSignature::Coercible(vec![
                           Coercion::new_exact(TypeSignatureClass::Decimal),
                           Coercion::new_exact(TypeSignatureClass::Decimal),
                       ]),
                       TypeSignature::Numeric(2),
                   ],
                   Volatility::Immutable,
               ),
   ```
   
   then in `return_type()` calculate the widened precision/scale according to 
spark rules
   
   and then in `invoke_with_args()` we can retrieve this calculated type via 
`ScalarFunctionArgs::return_type`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to