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

    https://github.com/apache/spark/pull/1741#discussion_r15731595
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala ---
    @@ -92,6 +95,62 @@ 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 retrieving the size of a Hive table.
    +   */
    +  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.
    +        def getFileSizeForTable(conf: HiveConf, table: Table): Long = {
    +          val path = table.getPath()
    +          var size: Long = 0L
    +          try {
    +            val fs = path.getFileSystem(conf)
    +            size = fs.getContentSummary(path).getLength()
    +          } catch {
    +            case e: Exception =>
    +              logger.warn(
    --- End diff --
    
    There have been some changes in logging use `logWarn(...)`


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