Safeguard round function decimal places overflow
Which issue does this PR close?
Closes #6133.
Rationale for this change
Add runtime check rather than crash the system.
What changes are included in this PR?
Safeguard the panic from round function decimal places overflow.
In #6133 stated there could be a type check in binding phase, only add the runtime check in this PR though I do agree having error throwing out in the logical planning might be better.
Are these changes tested?
Yes
Are there any user-facing changes?
No
Maybe we can simply change the Round to accept i32 here: https://github.com/apache/arrow-datafusion/blob/main/datafusion/expr/src/function.rs#L651-L654
Maybe we can simply change the
Roundto accept i32 here: https://github.com/apache/arrow-datafusion/blob/main/datafusion/expr/src/function.rs#L651-L654
Postgres output:
postgres=# select round(5.4323, 2147483648);
ERROR: function round(numeric, bigint) does not exist
LINE 1: select round(5.4323, 2147483648);
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
@viirya (or @liukun4515 ) do you have time to review / approve this PR? I haven't been following closely and I think you are the experts in Decimal implementation in DataFusion
I wonder if https://github.com/apache/arrow-datafusion/pull/6833 is similar functionality
I am not sure what is going on with this PR -- it now looks like a huge change and it has been stale for quite a while. Marking it as draft while we figure out what to do with it
I think the change is so out-of-dated from latest branch so the diffs are unclear what are actual change from this PR. It'd be better to sync up with latest branch.
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.