cloud-fan commented on code in PR #38495:
URL: https://github.com/apache/spark/pull/38495#discussion_r1021070839


##########
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveExternalCatalog.scala:
##########
@@ -722,18 +722,15 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, 
hadoopConf: Configurat
       stats: Option[CatalogStatistics]): Unit = withClient {
     requireTableExists(db, table)
     val rawTable = getRawTable(db, table)
-
-    // convert table statistics to properties so that we can persist them 
through hive client
+    val oldTableNonStatsProps = 
rawTable.properties.filterNot(_._1.startsWith(STATISTICS_PREFIX))
     val statsProperties =
       if (stats.isDefined) {
         statsToProperties(stats.get)
       } else {
         new mutable.HashMap[String, String]()
       }
 
-    val oldTableNonStatsProps = 
rawTable.properties.filterNot(_._1.startsWith(STATISTICS_PREFIX))
-    val updatedTable = rawTable.copy(properties = oldTableNonStatsProps ++ 
statsProperties)
-    client.alterTable(updatedTable)
+    client.alterTableStats(db, table, parameters = oldTableNonStatsProps ++ 
statsProperties)

Review Comment:
   We can pass `rawTable` to the hive client to avoid the extra RPC call. See 



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to