Skip to content

Commit

Permalink
fix URISyntaxException
Browse files Browse the repository at this point in the history
  • Loading branch information
scwf committed Feb 4, 2015
1 parent 5aa0f21 commit ea81daf
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.apache.hadoop.hive.ql.io.{HiveFileFormatUtils, HiveOutputFormat}
import org.apache.hadoop.hive.ql.plan.{PlanUtils, TableDesc}
import org.apache.hadoop.io.Writable
import org.apache.hadoop.mapred._
import org.apache.hadoop.hive.common.FileUtils

import org.apache.spark.mapred.SparkHadoopMapRedUtil
import org.apache.spark.sql.Row
Expand Down Expand Up @@ -212,9 +213,14 @@ private[spark] class SparkHiveDynamicPartitionWriterContainer(
.zip(row.toSeq.takeRight(dynamicPartColNames.length))
.map { case (col, rawVal) =>
val string = if (rawVal == null) null else String.valueOf(rawVal)
s"/$col=${if (string == null || string.isEmpty) defaultPartName else string}"
}
.mkString
s"/$col=${
if (string == null || string.isEmpty) {
defaultPartName
} else {
FileUtils.escapePathName(string)
}
}"
}.mkString

def newWriter = {
val newFileSinkDesc = new FileSinkDesc(
Expand Down

0 comments on commit ea81daf

Please sign in to comment.