New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-14668] [SQL] Move CurrentDatabase to Catalyst #12424
Conversation
@ExpressionDescription( | ||
usage = "_FUNC_() - Returns the current database.", | ||
extended = "> SELECT _FUNC_()") | ||
private[sql] case class CurrentDatabase(ctx: SQLContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm afraid this is too convoluted -- why don't we just have this function not taking any arguments, and then in the optimizer (which should take a SessionState) replace it with a literal? similar to how we compute CurrentDate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, but this is just moving code. We can clean that up later
Test build #55955 has finished for PR 12424 at commit
|
Test build #55953 has finished for PR 12424 at commit
|
Test build #55971 has finished for PR 12424 at commit
|
This conflicts with mine - but I can redo mine #12434 |
Merging in master. |
## What changes were proposed in this pull request? This PR moves `CurrentDatabase` from sql/hive package to sql/catalyst. It also adds the function description, which looks like the following. ``` scala> sqlContext.sql("describe function extended current_database").collect.foreach(println) [Function: current_database] [Class: org.apache.spark.sql.execution.command.CurrentDatabase] [Usage: current_database() - Returns the current database.] [Extended Usage: > SELECT current_database()] ``` ## How was this patch tested? Existing tests Author: Yin Huai <yhuai@databricks.com> Closes apache#12424 from yhuai/SPARK-14668.
What changes were proposed in this pull request?
This PR moves
CurrentDatabase
from sql/hive package to sql/catalyst. It also adds the function description, which looks like the following.How was this patch tested?
Existing tests