alamb commented on code in PR #10899:
URL: https://github.com/apache/datafusion/pull/10899#discussion_r1638358879
##########
datafusion/functions/src/math/round.rs:
##########
@@ -109,6 +109,9 @@ pub fn round(args: &[ArrayRef]) -> Result<ArrayRef> {
if args.len() == 2 {
decimal_places = ColumnarValue::Array(args[1].clone());
+ // if cast fails, we return error instead of panic. Better solution
would to update
+ // function signature and instead error during planning -- to be
improved later
+ _ = decimal_places.cast_to(&Int32, None)?;
Review Comment:
It looks good -- thanks!
Now that you are checking the result of converting `decimal_places`I think
we can avoid the call to `cast`
--
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]