dongjoon-hyun commented on a change in pull request #24523: [SPARK-27631][SQL] 
Avoid repeating calculate table statistics
URL: https://github.com/apache/spark/pull/24523#discussion_r284511075
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/CommandUtils.scala
 ##########
 @@ -43,13 +43,17 @@ object CommandUtils extends Logging {
   /** Change statistics after changing data by commands. */
   def updateTableStats(sparkSession: SparkSession, table: CatalogTable): Unit 
= {
     val catalog = sparkSession.sessionState.catalog
-    if (sparkSession.sessionState.conf.autoSizeUpdateEnabled) {
-      val newTable = catalog.getTableMetadata(table.identifier)
-      val newSize = CommandUtils.calculateTotalSize(sparkSession, newTable)
-      val newStats = CatalogStatistics(sizeInBytes = newSize)
-      catalog.alterTableStats(table.identifier, Some(newStats))
-    } else if (table.stats.nonEmpty) {
-      catalog.alterTableStats(table.identifier, None)
+    val statsMaybeUpdatedByHive = catalog.getTableMetadata(table.identifier)
 
 Review comment:
   This module is `sql/core`. We should not have an assumption with `Hive`. 
Please rename `statsMaybeUpdatedByHive` to more neutral one.
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to