Github user tejasapatil commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18309#discussion_r122102333
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/AnalyzeTableCommand.scala
 ---
    @@ -81,6 +83,19 @@ case class AnalyzeTableCommand(
     object AnalyzeTableCommand extends Logging {
     
       def calculateTotalSize(sessionState: SessionState, catalogTable: 
CatalogTable): Long = {
    +    if (catalogTable.partitionColumnNames.isEmpty) {
    +      calculateTotalSize(sessionState, catalogTable.identifier, 
catalogTable.storage.locationUri)
    +    } else {
    +      // Table = Sum(partitions)
    +      val partitions = 
sessionState.catalog.listPartitions(catalogTable.identifier)
    +      partitions.map(p =>
    +        calculateTotalSize(sessionState, catalogTable.identifier, 
p.storage.locationUri)
    +      ).sum
    +    }
    +  }
    +
    +  private def calculateTotalSize(sessionState: SessionState, tableId: 
TableIdentifier,
    --- End diff --
    
    nit: if the number of args exceeds line length, the code style is to have 
individual args on separate line with 4 spaces.
    
    ```
      private def calculateTotalSize(
          sessionState: SessionState,
          tableId: TableIdentifier,
          locationUri: Option[URI]): Long = {
        // This method is mainly based on
        ....
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to