Skip to content
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

Closed
wants to merge 1 commit into from
Closed

[SPARK-14668] [SQL] Move CurrentDatabase to Catalyst #12424

wants to merge 1 commit into from

Conversation

yhuai
Copy link
Contributor

@yhuai yhuai commented Apr 15, 2016

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

@ExpressionDescription(
usage = "_FUNC_() - Returns the current database.",
extended = "> SELECT _FUNC_()")
private[sql] case class CurrentDatabase(ctx: SQLContext)
Copy link
Contributor

@rxin rxin Apr 15, 2016

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.

Copy link
Contributor

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

@SparkQA
Copy link

SparkQA commented Apr 15, 2016

Test build #55955 has finished for PR 12424 at commit 6387829.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Apr 15, 2016

Test build #55953 has finished for PR 12424 at commit 7b01fd3.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai yhuai changed the title [SPARK-14668] [SQL] Move CurrentDatabase to sql/core [SPARK-14668] [SQL] Move CurrentDatabase to Catalyst Apr 15, 2016
@SparkQA
Copy link

SparkQA commented Apr 16, 2016

Test build #55971 has finished for PR 12424 at commit 269a5c0.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • abstract class Optimizer(
    • case class GetCurrentDatabase(sessionCatalog: SessionCatalog) extends Rule[LogicalPlan]
    • class SparkOptimizer(

@rxin
Copy link
Contributor

rxin commented Apr 16, 2016

This conflicts with mine - but I can redo mine #12434

@rxin
Copy link
Contributor

rxin commented Apr 16, 2016

Merging in master.

@asfgit asfgit closed this in b2dfa84 Apr 16, 2016
lw-lin pushed a commit to lw-lin/spark that referenced this pull request Apr 20, 2016
## 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants