Skip to content

Commit

Permalink
Revert "Refactor"
Browse files Browse the repository at this point in the history
This reverts commit b68e7b1.
  • Loading branch information
da-liii committed Dec 10, 2018
1 parent b68e7b1 commit 93d8515
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@ 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 key = ColumnProjectionUtils.READ_COLUMN_NAMES_CONF_STR
val value = Option(conf.get(key, null))
.map(old => cols.+:(old))
.getOrElse(cols)
.mkString(",")
conf.set(key, value)
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)
}

/*
Expand Down

0 comments on commit 93d8515

Please sign in to comment.