Skip to content

Commit 39a153c

Browse files
author
Andrew Or
committed
Take into account current database in table methods
1 parent 5bf695c commit 39a153c

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,13 @@ abstract class SessionCatalog(catalog: ExternalCatalog) {
6464
// sessions as their metadata is persisted in the underlying catalog.
6565
// ----------------------------------------------------------------------------
6666

67-
// Methods that interact with metastore tables only.
67+
// ----------------------------------------------------
68+
// | Methods that interact with metastore tables only |
69+
// ----------------------------------------------------
6870

6971
/**
7072
* Create a metastore table in the database specified in `tableDefinition`.
71-
* If no such table is specified, create it in the current database.
73+
* If no such database is specified, create it in the current database.
7274
*/
7375
def createTable(
7476
currentDb: String,
@@ -78,17 +80,23 @@ abstract class SessionCatalog(catalog: ExternalCatalog) {
7880
/**
7981
* Alter the metadata of an existing metastore table identified by `tableDefinition`.
8082
*
83+
* If no database is specified in `tableDefinition`, assume the table is in the
84+
* current database.
85+
*
8186
* Note: If the underlying implementation does not support altering a certain field,
8287
* this becomes a no-op.
8388
*/
84-
def alterTable(tableDefinition: CatalogTable): Unit
89+
def alterTable(currentDb: String, tableDefinition: CatalogTable): Unit
8590

8691
/**
8792
* Retrieve the metadata of an existing metastore table.
93+
* If no database is specified, assume the table is in the current database.
8894
*/
89-
def getTable(name: TableIdentifier): CatalogTable
95+
def getTable(currentDb: String, name: TableIdentifier): CatalogTable
9096

91-
// Methods that interact with temporary tables and metastore tables.
97+
// -------------------------------------------------------------
98+
// | Methods that interact with temporary and metastore tables |
99+
// -------------------------------------------------------------
92100

93101
/**
94102
* Create a temporary table.
@@ -208,7 +216,9 @@ abstract class SessionCatalog(catalog: ExternalCatalog) {
208216
// their metadata is persisted in the underlying catalog.
209217
// ----------------------------------------------------------------------------
210218

211-
// Methods that interact with metastore functions only.
219+
// -------------------------------------------------------
220+
// | Methods that interact with metastore functions only |
221+
// -------------------------------------------------------
212222

213223
def createFunction(currentDb: String, funcDefinition: CatalogFunction): Unit
214224

@@ -223,7 +233,9 @@ abstract class SessionCatalog(catalog: ExternalCatalog) {
223233
*/
224234
def alterFunction(currentDb: String, funcDefinition: CatalogFunction): Unit
225235

226-
// Methods that interact with temporary functions and metastore functions.
236+
// ----------------------------------------------------------------
237+
// | Methods that interact with temporary and metastore functions |
238+
// ----------------------------------------------------------------
227239

228240
def createTempFunction(funcDefinition: CatalogFunction): Unit
229241

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ case class CatalogTablePartition(
212212
* future once we have a better understanding of how we want to handle skewed columns.
213213
*/
214214
case class CatalogTable(
215-
// TODO: just use TableIdentifier here
216215
specifiedDatabase: Option[String],
217216
name: String,
218217
tableType: CatalogTableType,

0 commit comments

Comments
 (0)