-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[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
Conversation
Can one of the admins verify this patch? |
ok to test |
Test build #25276 has started for PR 3872 at commit
|
Test build #25276 has finished for PR 3872 at commit
|
Test PASSed. |
@@ -41,6 +41,8 @@ trait Catalog { | |||
|
|||
def unregisterAllTables(): Unit | |||
|
|||
def showTables(databaseName: Option[String]): immutable.List[String] |
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 think we should probably stick to generic Seq
in public interfaces like this.
Thanks for working on this! /cc @rxin |
Test build #25371 has started for PR 3872 at commit
|
I need to merge in new changes then I will push the branch again |
Test build #25371 has finished for PR 3872 at commit
|
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") |
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.
Beyond the line limit.
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.e. limit lines to 100 chars wide
a21b732
to
a42c963
Compare
Test build #25393 has started for PR 3872 at commit
|
Test build #25393 has finished for PR 3872 at commit
|
Test FAILed. |
Fixing style tests, thought I ran it locally... |
Test build #25394 has started for PR 3872 at commit
|
@@ -60,6 +60,10 @@ trait Catalog { | |||
protected def getDBTable(tableIdent: Seq[String]) : (Option[String], String) = { | |||
(tableIdent.lift(tableIdent.size - 2), tableIdent.last) | |||
} | |||
|
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.
remove empty line?
@@ -152,6 +160,16 @@ trait OverrideCatalog extends Catalog { | |||
override def unregisterAllTables(): Unit = { | |||
overrides.clear() | |||
} | |||
|
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.
empty line
@OopsOutOfMemory removed all empty lines, thanks for checking! |
Test build #25396 has started for PR 3872 at commit
|
Test build #25394 has finished for PR 3872 at commit
|
Test PASSed. |
Test build #25396 has finished for PR 3872 at commit
|
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) |
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.
This doesn't actually convert the list to an array, does it?
88c410d
to
4ef099b
Compare
Addressed latest comments, rebased branch. |
Test build #25696 has started for PR 3872 at commit
|
Test build #25696 has finished for PR 3872 at commit
|
Test PASSed. |
@yhuai I think it's a good idea, nice work. |
Closing this pull request in deference to the work being done in PR #4547 |
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.