cloud-fan commented on a change in pull request #34241:
URL: https://github.com/apache/spark/pull/34241#discussion_r735703034
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -671,17 +680,23 @@ private[hive] class HiveClientImpl(
db: String,
table: String,
specs: Seq[TablePartitionSpec],
- newSpecs: Seq[TablePartitionSpec]): Unit = withHiveState {
+ newSpecs: Seq[TablePartitionSpec]): Unit = withHiveState(0) {
require(specs.size == newSpecs.size, "number of old and new partition
specs differ")
val catalogTable = getTable(db, table)
val hiveTable = toHiveTable(catalogTable, Some(userName))
specs.zip(newSpecs).foreach { case (oldSpec, newSpec) =>
+ // Since Spark may throw exception when call client.getPartition(),
+ // Spark need to update hive client calls one by one.
Review comment:
ditto, let's refine the comment
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveClientImpl.scala
##########
@@ -671,17 +680,23 @@ private[hive] class HiveClientImpl(
db: String,
table: String,
specs: Seq[TablePartitionSpec],
- newSpecs: Seq[TablePartitionSpec]): Unit = withHiveState {
+ newSpecs: Seq[TablePartitionSpec]): Unit = withHiveState(0) {
require(specs.size == newSpecs.size, "number of old and new partition
specs differ")
val catalogTable = getTable(db, table)
val hiveTable = toHiveTable(catalogTable, Some(userName))
specs.zip(newSpecs).foreach { case (oldSpec, newSpec) =>
+ // Since Spark may throw exception when call client.getPartition(),
+ // Spark need to update hive client calls one by one.
+ HiveCatalogMetrics.incrementHiveClientCalls(1)
if (client.getPartition(hiveTable, newSpec.asJava, false) != null) {
throw new PartitionAlreadyExistsException(db, table, newSpec)
}
val hivePart = getPartitionOption(catalogTable, oldSpec)
.map { p => toHivePartition(p.copy(spec = newSpec), hiveTable) }
.getOrElse { throw new NoSuchPartitionException(db, table, oldSpec) }
+ // Since Spark may throw exception when call client.getPartition(),
+ // Spark need to update hive client calls one by one.
Review comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]