[ https://issues.apache.org/jira/browse/SPARK-34062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17262214#comment-17262214 ]
Apache Spark commented on SPARK-34062: -------------------------------------- User 'MaxGekk' has created a pull request for this issue: https://github.com/apache/spark/pull/31114 > Call updateTableStats() from AlterTableAddPartitionCommand > ---------------------------------------------------------- > > Key: SPARK-34062 > URL: https://issues.apache.org/jira/browse/SPARK-34062 > Project: Spark > Issue Type: Improvement > Components: SQL > Affects Versions: 3.2.0 > Reporter: Maxim Gekk > Priority: Major > > AlterTableAddPartitionCommand.run does almost the same as > `CommandUtils.updateTableStats` while updating table stats. The code: > {code:scala} > if (table.stats.nonEmpty) { > if (sparkSession.sessionState.conf.autoSizeUpdateEnabled) { > val addedSize = > CommandUtils.calculateMultipleLocationSizes(sparkSession, table.identifier, > parts.map(_.storage.locationUri)).sum > if (addedSize > 0) { > val newStats = CatalogStatistics(sizeInBytes = > table.stats.get.sizeInBytes + addedSize) > catalog.alterTableStats(table.identifier, Some(newStats)) > } > } else { > catalog.alterTableStats(table.identifier, None) > } > } > {code} > can be replaced by: > {code:scala} > CommandUtils.updateTableStats() > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org