GitHub user wangyum opened a pull request:
https://github.com/apache/spark/pull/18413
[SPARK-21205][SQL] pmod(number, 0) should be null.
## What changes were proposed in this pull request?
Hive `pmod(3.13, 0)`:
```:sql
hive> select pmod(3.13, 0);
OK
NULL
Time taken: 2.514 seconds, Fetched: 1 row(s)
hive>
```
Spark `mod(3.13, 0)`:
```:sql
spark-sql> select mod(3.13, 0);
NULL
spark-sql>
```
But the Spark `pmod(3.13, 0)`:
```:sql
spark-sql> select pmod(3.13, 0);
17/06/25 09:35:58 ERROR SparkSQLDriver: Failed in [select pmod(3.13, 0)]
java.lang.NullPointerException
at
org.apache.spark.sql.catalyst.expressions.Pmod.pmod(arithmetic.scala:504)
at
org.apache.spark.sql.catalyst.expressions.Pmod.nullSafeEval(arithmetic.scala:432)
at
org.apache.spark.sql.catalyst.expressions.BinaryExpression.eval(Expression.scala:419)
at
org.apache.spark.sql.catalyst.expressions.UnaryExpression.eval(Expression.scala:323)
...
```
This PR make `pmod(number, 0)` to null.
## 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-21205
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18413.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 #18413
commit ffd3bcbf09c239516f44c206ce8ce74fbcd4d712
Author: Yuming Wang
Date: 2017-06-25T01:45:28Z
pmod(number, 0) should be null.
---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---
-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org