datafusion icon indicating copy to clipboard operation
datafusion copied to clipboard

Safeguard round function decimal places overflow

Open tz70s opened this issue 2 years ago • 7 comments

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

tz70s avatar May 04 '23 16:05 tz70s

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

tz70s avatar May 04 '23 17:05 tz70s

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

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.

tz70s avatar May 04 '23 17:05 tz70s

@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

alamb avatar Jun 15 '23 14:06 alamb

I wonder if https://github.com/apache/arrow-datafusion/pull/6833 is similar functionality

alamb avatar Jul 03 '23 19:07 alamb

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

alamb avatar Jul 18 '23 20:07 alamb

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.

viirya avatar Jul 19 '23 00:07 viirya

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.

github-actions[bot] avatar May 08 '24 01:05 github-actions[bot]