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

    https://github.com/apache/spark/pull/1741#discussion_r15736318
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala ---
    @@ -93,6 +97,83 @@ class HiveContext(sc: SparkContext) extends 
SQLContext(sc) {
         catalog.createTable("default", tableName, 
ScalaReflection.attributesFor[A], allowExisting)
       }
     
    +  /**
    +   * Analyzes the given table in the current database to generate 
statistics, which will be
    +   * used in query optimizations.
    +   *
    +   * Right now, it only supports Hive tables and it only updates the size 
of a Hive table
    +   * in the Hive metastore.
    +   */
    +  def analyze(tableName: String) {
    +    val relation = catalog.lookupRelation(None, tableName) match {
    +      case LowerCaseSchema(r) => r
    +      case o => o
    +    }
    +
    +    relation match {
    +      case relation: MetastoreRelation => {
    +        // This method is borrowed from
    +        // 
org.apache.hadoop.hive.ql.stats.StatsUtils.getFileSizeForTable(HiveConf, Table)
    +        // in Hive 0.13.
    +        // TODO: Generalize statistics collection.
    +        // TODO: Can we use fs.getContentSummary?
    +        // Seems fs.getContentSummary returns wrong table size on Jenkins. 
So we use
    +        // countFileSize to count the table size.
    +        def countFileSize(fs: FileSystem, path: Path): Long = {
    --- End diff --
    
    It should be `calculateTableSize`.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to