Skip to content

Conversation

@windpiger
Copy link
Contributor

@windpiger windpiger commented Mar 18, 2017

What changes were proposed in this pull request?

merge renameTable to alterTable in ExternalCatalog has some reasons:

  1. In Hive, we rename a Table by alterTable
  2. Currently when we create / rename a managed table, we should get the defaultTablePath for them in ExternalCatalog, then we have two defaultTablePath logic in its two subclass HiveExternalCatalog and InMemoryCatalog, additionally there is also a defaultTablePath in SessionCatalog, so till now we have three defaultTablePath in three classes.
    we'd better to unify them up to SessionCatalog

To unify them, we should move some logic from ExternalCatalog to SessionCatalog, renameTable is one of this.

while limit to the simple parameters in renameTable

  def renameTable(db: String, oldName: String, newName: String): Unit

even if we move the defaultTablePath logic to SessionCatalog, we can not pass it to renameTable.

So we can merge the renameTable to alterTable, and rename it in alterTable.

How was this patch tested?

delete some tests in ExternalCatalogSuite which already existed in SessionCatalogSuite,
and move some other tests in ExternalCatalogSuite which does not exist in SessionCatalogSuite

}
}

test("alter table") {
Copy link
Contributor Author

@windpiger windpiger Mar 18, 2017

Choose a reason for hiding this comment

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

already existed in SessionCatalogSuite

assert(newTbl1.properties.get("toh") == Some("frem"))
}

test("alter table when database/table does not exist") {
Copy link
Contributor Author

@windpiger windpiger Mar 18, 2017

Choose a reason for hiding this comment

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

already existed in SessionCatalogSuite

}
}

test("rename table when destination table already exists") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

move to SessionCatalog

catalog.dropTable("db2", "unknown_table", ignoreIfNotExists = true, purge = false)
}

test("rename table") {
Copy link
Contributor Author

@windpiger windpiger Mar 18, 2017

Choose a reason for hiding this comment

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

already existed in SessionCatalogSuite

assert(catalog.listTables("db2").toSet == Set("tblone", "tbl2"))
}

test("rename table when database/table does not exist") {
Copy link
Contributor Author

@windpiger windpiger Mar 18, 2017

Choose a reason for hiding this comment

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

already existed in SessionCatalogSuite

assert(!exists(db.locationUri))
}

test("create/drop/rename table should create/delete/rename the directory") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

move to SessionCatalogSuite

@SparkQA
Copy link

SparkQA commented Mar 18, 2017

Test build #74777 has finished for PR 17340 at commit 26c6c7b.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 18, 2017

Test build #74778 has finished for PR 17340 at commit 8d287d3.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Mar 18, 2017

Test build #74779 has finished for PR 17340 at commit 7c8d92b.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@windpiger windpiger changed the title [SPARK-20013][SQL] merge renameTable to alterTable in ExternCatalog [SPARK-20013][SQL][WIP] merge renameTable to alterTable in ExternCatalog Mar 18, 2017
@SparkQA
Copy link

SparkQA commented Mar 18, 2017

Test build #74780 has finished for PR 17340 at commit bea0956.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@windpiger windpiger closed this Mar 18, 2017
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.

2 participants