GitHub user gatorsmile opened a pull request:
https://github.com/apache/spark/pull/17652
[SPARK-20335] [SQL] [BACKPORT-2.1] Children expressions of Hive UDF impacts
the determinism of Hive UDF
### What changes were proposed in this pull request?
This PR is to backport https://github.com/apache/spark/pull/17635 to Spark
2.1
---
```JAVA
/**
* Certain optimizations should not be applied if UDF is not
deterministic.
* Deterministic UDF returns same result each time it is invoked with a
* particular input. This determinism just needs to hold within the
context of
* a query.
*
* @return true if the UDF is deterministic
*/
boolean deterministic() default true;
```
Based on the definition of
[UDFType](https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFType.java#L42-L50),
when Hive UDF's children are non-deterministic, Hive UDF is also
non-deterministic.
### How was this patch tested?
Added test cases.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gatorsmile/spark backport-17635
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/17652.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 #17652
----
commit 68d1e4d47c6479e899e59777c7a6e86f2d6e75dd
Author: Xiao Li <[email protected]>
Date: 2017-04-16T20:34:34Z
fix.
----
---
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]