[
https://issues.apache.org/jira/browse/SPARK-34062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maxim Gekk updated SPARK-34062:
-------------------------------
Parent: SPARK-33507
Issue Type: Sub-task (was: Improvement)
> Call updateTableStats() from AlterTableAddPartitionCommand
> ----------------------------------------------------------
>
> Key: SPARK-34062
> URL: https://issues.apache.org/jira/browse/SPARK-34062
> Project: Spark
> Issue Type: Sub-task
> 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: [email protected]
For additional commands, e-mail: [email protected]