diegoQuinas opened a new issue, #22:
URL: https://github.com/apache/datafusion-spark/issues/22

   ### Is your feature request related to a problem or challenge?
   
   Follow-up to apache/datafusion-spark#15 / apache/datafusion#21710.
   
   apache/datafusion#21710 added 2-argument `ceil(value, scale)` to 
`datafusion-spark` for integer and floating-point inputs. The decimal path was 
deliberately left out of scope: `ceil(Decimal128(p, s), scale)` currently 
errors at planning time with `"2-argument ceil is not yet supported for decimal 
inputs"`.
   
   Spark supports this form for decimal inputs and derives the result 
`(precision, scale)` from the literal `scale` argument, matching `RoundCeil` 
semantics. For example:
   
   - `ceil(3.1411::decimal(5,4), 3)`  → `decimal(5, 3)` value `3.142`
   - `ceil(3.1411::decimal(5,4), -3)` → `decimal(4, 0)` value `1000`
   
   ### Describe the solution you'd like
   
   Implement the decimal path in `SparkCeil`:
   
   - Use `return_field_from_args` so the literal `scale` can drive the output 
`(precision, scale)`.
   - When `scale` is not visible as a literal at plan time (column, non-literal 
cast), fall back to a conservative `Decimal128(min(p + 1, 38), s)`, same 
approach as `datafusion/functions/round`.
   - Execution: operate on the unscaled integer, then rescale to the advertised 
output scale.
   - Follow Spark's wrapping behavior on overflow (no error), matching the 
existing 1-arg `Decimal128` path.
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


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