File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
sql/hive/src/main/scala/org/apache/spark Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,33 @@ private[hive] class SparkHiveHadoopWriter(
9393 null )
9494 }
9595
96+ def open (dynamicPartPath : String ) {
97+ val numfmt = NumberFormat .getInstance()
98+ numfmt.setMinimumIntegerDigits(5 )
99+ numfmt.setGroupingUsed(false )
100+
101+ val extension = Utilities .getFileExtension(
102+ conf.value,
103+ fileSinkConf.getCompressed,
104+ getOutputFormat())
105+
106+ val outputName = " part-" + numfmt.format(splitID) + extension
107+ val outputPath : Path = FileOutputFormat .getOutputPath(conf.value)
108+ if (outputPath == null ) {
109+ throw new IOException (" Undefined job output-path" )
110+ }
111+ val workPath = new Path (outputPath, dynamicPartPath.substring(1 ))// remove "/"
112+ val path = new Path (workPath, outputName)
113+ getOutputCommitter().setupTask(getTaskContext())
114+ writer = HiveFileFormatUtils .getHiveRecordWriter(
115+ conf.value,
116+ fileSinkConf.getTableInfo,
117+ conf.value.getOutputValueClass.asInstanceOf [Class [Writable ]],
118+ fileSinkConf,
119+ path,
120+ null )
121+ }
122+
96123 def write (value : Writable ) {
97124 if (writer != null ) {
98125 writer.write(value)
You can’t perform that action at this time.
0 commit comments