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


##########
datafusion/spark/src/function/math/ceil.rs:
##########
@@ -301,4 +443,95 @@ mod tests {
         };
         assert_eq!(result, ScalarValue::Int64(Some(48)));
     }
+
+    #[test]
+    fn test_ceil_float64_scalar_with_positive_scale() {
+        // ceil(3.1411, 2) → 3.15
+        let args = vec![
+            ColumnarValue::Scalar(ScalarValue::Float64(Some(3.1411))),
+            ColumnarValue::Scalar(ScalarValue::Int32(Some(2))),
+        ];
+        let result = match spark_ceil(&args).unwrap() {
+            ColumnarValue::Scalar(v) => v,
+            _ => panic!("Expected scalar"),
+        };
+        assert_eq!(result, ScalarValue::Float64(Some(3.15)));
+    }
+
+    #[test]
+    fn test_ceil_float64_scalar_with_negative_scale() {

Review Comment:
   Could we move all these tests to SLTs instead



##########
datafusion/spark/src/function/math/ceil.rs:
##########
@@ -52,8 +53,50 @@ impl Default for SparkCeil {
 
 impl SparkCeil {
     pub fn new() -> Self {
+        let decimal = Coercion::new_exact(TypeSignatureClass::Decimal);

Review Comment:
   It feels we can simplify this signature to:
   
   ```rust
   Signature::one_of(
       vec![
           TypeSignature::numeric(1, Volatility::Immutable),
           TypeSignature::Coercible(vec![
               Coercion::new_exact(TypeSignatureClass::Numeric),
              decimal_places,
           ]).
       ]
   )
   ```
   
   - That is, there doesn't seem to be a need to split into `integer`, 
`decimal`, `float32`, `float64` since they all fall under the umbrella of 
`TypeSignatureClass::Numeric`



-- 
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