You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by maomaoChibei <gi...@git.apache.org> on 2018/12/10 09:01:27 UTC

[GitHub] spark pull request #23268: [SPARK-26319][SQL][Test] Add appendReadColumns Un...

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

    https://github.com/apache/spark/pull/23268#discussion_r240126376
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala ---
    @@ -53,19 +53,12 @@ private[hive] object HiveShim {
        * This function in hive-0.13 become private, but we have to do this to work around hive bug
        */
       private def appendReadColumnNames(conf: Configuration, cols: Seq[String]) {
    -    val old: String = conf.get(ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR, "")
    -    val result: StringBuilder = new StringBuilder(old)
    -    var first: Boolean = old.isEmpty
    -
    -    for (col <- cols) {
    -      if (first) {
    -        first = false
    -      } else {
    -        result.append(',')
    -      }
    -      result.append(col)
    -    }
    -    conf.set(ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR, result.toString)
    +    val key = ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR
    +    val value = Option(conf.get(key, null))
    +      .map(old => cols.+:(old))
    +      .getOrElse(cols)
    +      .mkString(",")
    --- End diff --
    
    gotcha


---

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