Skip to content

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

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 <[email protected]>

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

Development

Successfully merging this pull request may close these issues.

4 participants