You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maxim Gekk (Jira)" <ji...@apache.org> on 2021/01/10 16:02:00 UTC

[jira] [Created] (SPARK-34062) Call updateTableStats() from AlterTableAddPartitionCommand

Maxim Gekk created SPARK-34062:
----------------------------------

             Summary: 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


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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org