Repository: hive Updated Branches: refs/heads/master 23d20e649 -> 823aadad5
HIVE-16861: MapredParquetOutputFormat - Save Some Array Allocations (BELUGA BEHR, reviewed by Aihua Xu) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/823aadad Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/823aadad Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/823aadad Branch: refs/heads/master Commit: 823aadad5fbfb51a2eb4c07d8cb0044156699126 Parents: 23d20e6 Author: BELUGA BEHR <dam6...@gmail.com> Authored: Thu Apr 26 12:06:43 2018 -0500 Committer: Sahil Takiar <stak...@cloudera.com> Committed: Thu Apr 26 12:07:11 2018 -0500 ---------------------------------------------------------------------- .../ql/io/parquet/MapredParquetOutputFormat.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/823aadad/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/MapredParquetOutputFormat.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/MapredParquetOutputFormat.java b/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/MapredParquetOutputFormat.java index 6e05526..ba235f7 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/MapredParquetOutputFormat.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/io/parquet/MapredParquetOutputFormat.java @@ -14,8 +14,8 @@ package org.apache.hadoop.hive.ql.io.parquet; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Properties; @@ -101,23 +101,20 @@ public class MapredParquetOutputFormat extends FileOutputFormat<NullWritable, Pa final Properties tableProperties, final Progressable progress) throws IOException { - LOG.info("creating new record writer..." + this); + LOG.info("Creating new record writer: {}", this); final String columnNameProperty = tableProperties.getProperty(IOConstants.COLUMNS); final String columnTypeProperty = tableProperties.getProperty(IOConstants.COLUMNS_TYPES); - List<String> columnNames; - List<TypeInfo> columnTypes; + List<String> columnNames = Collections.emptyList(); + List<TypeInfo> columnTypes = Collections.emptyList(); final String columnNameDelimiter = tableProperties.containsKey(serdeConstants.COLUMN_NAME_DELIMITER) ? tableProperties .getProperty(serdeConstants.COLUMN_NAME_DELIMITER) : String.valueOf(SerDeUtils.COMMA); - if (columnNameProperty.length() == 0) { - columnNames = new ArrayList<String>(); - } else { + + if (!columnNameProperty.isEmpty()) { columnNames = Arrays.asList(columnNameProperty.split(columnNameDelimiter)); } - if (columnTypeProperty.length() == 0) { - columnTypes = new ArrayList<TypeInfo>(); - } else { + if (!columnTypeProperty.isEmpty()) { columnTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty); }