commit 6977cf9fc86e26809446bfa3092a4189acbc6150 Author: Ivan Suller Date: Fri May 24 14:57:25 2019 +0200 HIVE-21789 diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java index b37558c063..d91cd60668 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java @@ -1617,9 +1617,8 @@ static void createEmptyBuckets(Configuration hconf, List paths, for (Path path : paths) { Utilities.FILE_OP_LOGGER.trace("creating empty bucket for {}", path); - RecordWriter writer = HiveFileFormatUtils.getRecordWriter( - jc, hiveOutputFormat, outputClass, isCompressed, - tableInfo.getProperties(), path, reporter); + RecordWriter writer = hiveOutputFormat.getHiveRecordWriter(jc, path, outputClass, isCompressed, + tableInfo.getProperties(), reporter); writer.close(false); LOG.info("created empty bucket for enforcing bucketing at {}", path); } diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/RowContainer.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/RowContainer.java index 901d544859..4a47ca0278 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/RowContainer.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/RowContainer.java @@ -541,9 +541,8 @@ protected void setupWriter() throws HiveException { HiveOutputFormat hiveOutputFormat = HiveFileFormatUtils.getHiveOutputFormat(jc, tblDesc); tempOutPath = new Path(tmpFile.toString()); JobConf localJc = getLocalFSJobConfClone(jc); - rw = HiveFileFormatUtils.getRecordWriter(this.jobCloneUsingLocalFs, - hiveOutputFormat, serde.getSerializedClass(), false, - tblDesc.getProperties(), tempOutPath, reporter); + rw = hiveOutputFormat.getHiveRecordWriter(localJc, tempOutPath, serde.getSerializedClass(), + false, tblDesc.getProperties(), reporter); } catch (Exception e) { clearRows(); LOG.error(e.toString(), e); diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java index bd15fa4a8a..d224b3e0de 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveFileFormatUtils.java @@ -270,7 +270,7 @@ public static RecordWriter getHiveRecordWriter(JobConf jc, String codecStr = conf.getCompressCodec(); if (codecStr != null && !codecStr.trim().equals("")) { Class codec = - (Class) JavaUtils.loadClass(codecStr); + JavaUtils.loadClass(codecStr); FileOutputFormat.setOutputCompressorClass(jc_output, codec); } String type = conf.getCompressType(); @@ -279,25 +279,13 @@ public static RecordWriter getHiveRecordWriter(JobConf jc, SequenceFileOutputFormat.setOutputCompressionType(jc, style); } } - return getRecordWriter(jc_output, hiveOutputFormat, outputClass, - isCompressed, tableInfo.getProperties(), outPath, reporter); + return hiveOutputFormat.getHiveRecordWriter(jc_output, outPath, outputClass, isCompressed, + tableInfo.getProperties(), reporter); } catch (Exception e) { throw new HiveException(e); } } - public static RecordWriter getRecordWriter(JobConf jc, - OutputFormat outputFormat, - Class valueClass, boolean isCompressed, - Properties tableProp, Path outPath, Reporter reporter - ) throws IOException, HiveException { - if (!(outputFormat instanceof HiveOutputFormat)) { - outputFormat = new HivePassThroughOutputFormat(outputFormat); - } - return ((HiveOutputFormat)outputFormat).getHiveRecordWriter( - jc, outPath, valueClass, isCompressed, tableProp, reporter); - } - public static HiveOutputFormat getHiveOutputFormat(Configuration conf, TableDesc tableDesc) throws HiveException { return getHiveOutputFormat(conf, tableDesc.getOutputFileFormatClass());