kumarUjjawal commented on code in PR #19752:
URL: https://github.com/apache/datafusion/pull/19752#discussion_r2680822239
##########
datafusion/functions/src/math/ceil.rs:
##########
@@ -95,6 +95,31 @@ impl ScalarUDFImpl for CeilFunc {
}
fn invoke_with_args(&self, args: ScalarFunctionArgs) ->
Result<ColumnarValue> {
+ let arg = &args.args[0];
+
+ // Scalar fast path for float types - avoid array conversion overhead
+ // Note: Decimal types use the array path for proper
precision/overflow validation
+ if let ColumnarValue::Scalar(scalar) = arg {
+ match scalar {
+ ScalarValue::Float64(v) => {
+ return Ok(ColumnarValue::Scalar(ScalarValue::Float64(
+ v.map(f64::ceil),
+ )));
+ }
+ ScalarValue::Float32(v) => {
+ return Ok(ColumnarValue::Scalar(ScalarValue::Float32(
+ v.map(f32::ceil),
+ )));
+ }
+ ScalarValue::Null => {
+ return
Ok(ColumnarValue::Scalar(ScalarValue::Float64(None)));
+ }
+ // Decimal types fall through to array path for overflow
validation
Review Comment:
Thanks for the feedback.
--
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]