adriangb commented on code in PR #25732:
URL: https://github.com/apache/datafusion/pull/25732#discussion_r4299219724


##########
datafusion/functions/src/math/trunc.rs:
##########
@@ -162,10 +162,6 @@ impl ScalarUDFImpl for TruncFunc {
             }
         };
 
-        // Whether an explicit precision argument was supplied. The array fast
-        // paths below must only apply to the two-argument form: 
single-argument
-        // `trunc(x)` uses a different zero handling (mapping `-0.0` to `0.0`)
-        // that must be preserved.
         let has_precision_arg = args.args.len() == 2;

Review Comment:
   Nit for a followup: the removed comment was the only reason for this flag. 
With this PR, `trunc(x)` and `trunc(x, 0)` give the same result, and 
`truncate_float_array` with precision 0 also keeps `-0.0` (`(x * 1.0).trunc() / 
1.0`). So we can remove `has_precision_arg` and the two `has_precision_arg &&` 
guards below. Then the one-argument column form also uses the fast path.



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