[SPARK-34153][SQL] Remove unused getRawTable() from HiveExternalCatalog.alterPartitions()

### What changes were proposed in this pull request?
Remove unused call of `getRawTable()` from `HiveExternalCatalog.alterPartitions()`.

### Why are the changes needed?
It reduces the number of calls to Hive External catalog.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
By running the modified test suite:
```
$ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *AlterTableRenamePartitionSuite"
```

Closes #31234 from MaxGekk/remove-getRawTable-from-alterPartitions.

Authored-by: Max Gekk <max.gekk@gmail.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
This commit is contained in:
Max Gekk 2021-01-19 11:42:33 +09:00 committed by HyukjinKwon
parent 514172aae7
commit bea10a6274
2 changed files with 8 additions and 3 deletions

View file

@ -1144,9 +1144,6 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
table: String,
newParts: Seq[CatalogTablePartition]): Unit = withClient {
val metaStoreParts = newParts.map(p => p.copy(spec = toMetaStorePartitionSpec(p.spec)))
val rawTable = getRawTable(db, table)
// convert partition statistics to properties so that we can persist them through hive api
val withStatsProps = metaStoreParts.map { p =>
if (p.stats.isDefined) {

View file

@ -40,5 +40,13 @@ class AlterTableRenamePartitionSuite
sql(s"ALTER TABLE $t PARTITION (part=1) RENAME TO PARTITION (part=2)")
}
}
withNamespaceAndTable("ns", "tbl") { t =>
sql(s"CREATE TABLE $t (id int, PART int) $defaultUsing PARTITIONED BY (PART)")
sql(s"INSERT INTO $t PARTITION (PART=0) SELECT 0")
checkHiveClientCalls(expected = 26) {
sql(s"ALTER TABLE $t PARTITION (PART=0) RENAME TO PARTITION (PART=1)")
}
}
}
}