pchintar commented on code in PR #22697:
URL: https://github.com/apache/datafusion/pull/22697#discussion_r3347672444
##########
datafusion/functions/src/math/round.rs:
##########
@@ -468,6 +487,11 @@ fn round_columnar(
let decimal_places_is_array = matches!(decimal_places,
ColumnarValue::Array(_));
let arr: ArrayRef = match (value_array.data_type(), return_type) {
Review Comment:
Hi @kumarUjjawal I've restored the fast path for non-negative scalar
`decimal_places` values while still using `round_integer_array` for negative
and column-valued `decimal_places`.
Before:
```rust
(input_type, return_type)
if input_type == return_type && is_integer_data_type(return_type) =>
{
round_integer_array(value_array.as_ref(), decimal_places, return_type)?
}
```
Now:
```rust
(input_type, return_type)
if input_type == return_type && is_integer_data_type(return_type) =>
{
match decimal_places {
ColumnarValue::Scalar(ScalarValue::Int32(Some(dp))) if *dp >= 0 => {
value_array
}
_ => round_integer_array(
value_array.as_ref(),
decimal_places,
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]