GitHub user wangyum opened a pull request:
https://github.com/apache/spark/pull/18175
[SPARK-20951][SQL] Built-in SQL Function FormatNumber validate input value
## What changes were proposed in this pull request?
SQL Function `FormatNumber` should validate input value, if `argument 2 <
0` throw `TypeCheckFailure` same as Hive's way . after this pr:
```:sql
spark-sql> select format_number(12332.123456, -4);
Error in query: cannot resolve 'format_number(12332.123456BD, -4)' due to
data type mismatch: Argument 2 of function FORMAT_NUMBER must be >= 0, but -4
was found; line 1 pos 7;
'Project [unresolvedalias(format_number(12332.123456, -4), None)]
+- OneRowRelation$
spark-sql>
```
## How was this patch tested?
unit tests
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/wangyum/spark SPARK-20951
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18175.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #18175
----
commit da4c49d2e8634d466d0453aabfa18388844ea39d
Author: Yuming Wang <[email protected]>
Date: 2017-06-01T10:00:34Z
FormatNumber validate input value
commit 655ec8fdc2dfa567a6ed767fef89448b37807f16
Author: Yuming Wang <[email protected]>
Date: 2017-06-01T10:11:06Z
fix import order
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]