GitHub user DoingDone9 opened a pull request:
https://github.com/apache/spark/pull/5538
[SPARK-6198][SQL] Support "select current_database()"
to support "select current_database()"
```
The method(evaluate) has changed in UDFCurrentDB, it just throws a
exception.But hiveUdfs call this method and failed.
@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException
{ throw new IllegalStateException("never");
```
This udf expression is foldable, then it will be computed in
ConstantFolding of Optimizer. So I will get the name of currentDB after
optimizer not after execution.
```
== Analyzed Logical Plan ==
Project [HiveGenericUdf#org.apache.spark.sql.hive.sqlUDFCurrentDB() AS
_c0#59]
NoRelation$
== Optimized Logical Plan ==
Project [default AS _c0#59]
NoRelation$
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/DoingDone9/spark current_database
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/5538.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 #5538
----
commit 5f3cffd0c75ea717151ed5dab7ac42e4608d6583
Author: Xu Tingjun <[email protected]>
Date: 2015-03-26T01:19:00Z
abc
commit a81218ccf207f23f4bbfc719cce702ae10eb8b65
Author: Xu Tingjun <[email protected]>
Date: 2015-03-26T01:32:56Z
abc
commit e0c18f36a49e6f55fb30f00e5e38b5b0d7b18f24
Author: Zhongshuai Pei <[email protected]>
Date: 2015-04-16T02:12:46Z
to adapter hive0.12
hive0.12 do not have org.apache.hadoop.hive.ql.udf.generic.UDFCurrentDB
commit 6581284a5ee7e837c0cc6b29c38300480772dcf0
Author: Zhongshuai Pei <[email protected]>
Date: 2015-04-16T02:23:00Z
Update sqlUDFCurrentDB.scala
commit def60c3d84739811e0b7389af896bd6fc21274b1
Author: Zhongshuai Pei <[email protected]>
Date: 2015-04-16T02:51:28Z
Update sqlUDFCurrentDB.scala
----
---
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]