Skip to content

[SPARK-3299][SQL] add to SQLContext API to show tables #3872

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

Closed

Conversation

bbejeck
Copy link
Member

@bbejeck bbejeck commented Jan 1, 2015

SPARK-3299 Add to the SQLContext the ability to show tables, updated the Catalog, OverrideCatalog Traits, SimpleCatalog class, EmptyCatalog object, SQLContext class and the HiveMetastoreCatalog class. Added tests in ListTablesSuite. The method 'showTables' has been added, takes one parameter of type Optional[String] used for designating a database. I tried to include the HiveMetastoreCatalog class in the unit testing but was unsuccessful in being able to get a test to run. I will follow up on the developer list with questions on how to do this and update accordingly.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@andrewor14
Copy link
Contributor

@bbejeck Could you change the title to include [SPARK-3299][SQL] instead? This will help us sort our PRs.
@marmbrus

@andrewor14
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented Jan 8, 2015

Test build #25276 has started for PR 3872 at commit c5609fa.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 9, 2015

Test build #25276 has finished for PR 3872 at commit c5609fa.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25276/
Test PASSed.

@bbejeck bbejeck changed the title Spark 3299 add to SQLContext API to show tables [SPARK-3299][SQL] add to SQLContext API to show tables Jan 9, 2015
@@ -41,6 +41,8 @@ trait Catalog {

def unregisterAllTables(): Unit

def showTables(databaseName: Option[String]): immutable.List[String]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably stick to generic Seq in public interfaces like this.

@marmbrus
Copy link
Contributor

Thanks for working on this!

/cc @rxin

@SparkQA
Copy link

SparkQA commented Jan 11, 2015

Test build #25371 has started for PR 3872 at commit a21b732.

  • This patch does not merge cleanly.

@bbejeck
Copy link
Member Author

bbejeck commented Jan 11, 2015

I need to merge in new changes then I will push the branch again

@SparkQA
Copy link

SparkQA commented Jan 11, 2015

Test build #25371 has finished for PR 3872 at commit a21b732.

  • This patch fails Spark unit tests.
  • This patch does not merge cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25371/
Test FAILed.

class ListTablesSuite extends FunSuite with Matchers with BeforeAndAfter {

val simpleCatalog = new SimpleCatalog(true)
val expectedTablesOne = List("org.apache.spark.sql.ListTablesSuite.foo", "org.apache.spark.sql.ListTablesSuite.bar", "org.apache.spark.sql.ListTablesSuite.baz")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beyond the line limit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. limit lines to 100 chars wide

@bbejeck bbejeck force-pushed the spark-3299-SQLContext-list_tables branch from a21b732 to a42c963 Compare January 12, 2015 02:52
@SparkQA
Copy link

SparkQA commented Jan 12, 2015

Test build #25393 has started for PR 3872 at commit a42c963.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 12, 2015

Test build #25393 has finished for PR 3872 at commit a42c963.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25393/
Test FAILed.

@bbejeck
Copy link
Member Author

bbejeck commented Jan 12, 2015

Fixing style tests, thought I ran it locally...

@SparkQA
Copy link

SparkQA commented Jan 12, 2015

Test build #25394 has started for PR 3872 at commit 90cbd43.

  • This patch merges cleanly.

@bbejeck
Copy link
Member Author

bbejeck commented Jan 12, 2015

I believe I've made all suggested changes, branch was out of date so it's been rebased, just waiting for tests to finish. Thanks to @marmbrus and @rxin for the guidance.

@@ -60,6 +60,10 @@ trait Catalog {
protected def getDBTable(tableIdent: Seq[String]) : (Option[String], String) = {
(tableIdent.lift(tableIdent.size - 2), tableIdent.last)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line?

@@ -152,6 +160,16 @@ trait OverrideCatalog extends Catalog {
override def unregisterAllTables(): Unit = {
overrides.clear()
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line

@bbejeck
Copy link
Member Author

bbejeck commented Jan 12, 2015

@OopsOutOfMemory removed all empty lines, thanks for checking!

@SparkQA
Copy link

SparkQA commented Jan 12, 2015

Test build #25396 has started for PR 3872 at commit 88c410d.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 12, 2015

Test build #25394 has finished for PR 3872 at commit 90cbd43.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25394/
Test PASSed.

@SparkQA
Copy link

SparkQA commented Jan 12, 2015

Test build #25396 has finished for PR 3872 at commit 88c410d.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25396/
Test PASSed.


// Necessary helper method so showTables can return Array[String] vs List
private def convertToArray(tables: java.util.List[String]): Array[String] = {
new Array[String](tables.length)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't actually convert the list to an array, does it?

@bbejeck bbejeck force-pushed the spark-3299-SQLContext-list_tables branch from 88c410d to 4ef099b Compare January 17, 2015 04:59
@bbejeck
Copy link
Member Author

bbejeck commented Jan 17, 2015

Addressed latest comments, rebased branch.

@SparkQA
Copy link

SparkQA commented Jan 17, 2015

Test build #25696 has started for PR 3872 at commit 4ef099b.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Jan 17, 2015

Test build #25696 has finished for PR 3872 at commit 4ef099b.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/25696/
Test PASSed.

@yhuai
Copy link
Contributor

yhuai commented Feb 12, 2015

@bbejeck Thank you for working on this. I made another version based on yours (see #4547). What do you think about that approach (returning a DataFrame containing names of existing tables)?

@bbejeck
Copy link
Member Author

bbejeck commented Feb 12, 2015

@yhuai I think it's a good idea, nice work.

@bbejeck
Copy link
Member Author

bbejeck commented Feb 12, 2015

@yhuai , @marmbrus , @rxin should I close out my pull request, or would both of these be combined somehow?

@yhuai
Copy link
Contributor

yhuai commented Feb 12, 2015

@bbejeck Yes, please close yours. We can continue the work in #4547. Also, feel free to leave comments in that PR. Thank you for working on it!

@bbejeck bbejeck closed this Feb 12, 2015
@bbejeck
Copy link
Member Author

bbejeck commented Feb 12, 2015

Closing this pull request in deference to the work being done in PR #4547

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.

8 participants