HIVE-17732 : Minor Improvements - org.apache.hive.hcatalog.data.JsonSerDe.java (Beluga Behr via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1031b264 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1031b264 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1031b264 Branch: refs/heads/hive-14535 Commit: 1031b264969f822f6f70d3134ad0e28e855d37d9 Parents: bc8149c Author: BELUGA BEHR <[email protected]> Authored: Mon Oct 9 12:20:47 2017 -0700 Committer: Ashutosh Chauhan <[email protected]> Committed: Mon Oct 9 12:20:47 2017 -0700 ---------------------------------------------------------------------- .../org/apache/hive/hcatalog/data/JsonSerDe.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/1031b264/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java ---------------------------------------------------------------------- diff --git a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java index 831e857..17f9909 100644 --- a/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java +++ b/hcatalog/core/src/main/java/org/apache/hive/hcatalog/data/JsonSerDe.java @@ -106,10 +106,7 @@ public class JsonSerDe extends AbstractSerDe { List<TypeInfo> columnTypes; StructTypeInfo rowTypeInfo; - - LOG.debug("Initializing JsonSerDe"); - LOG.debug("props to serde: {}", tbl.entrySet()); - + LOG.debug("Initializing JsonSerDe: {}", tbl.entrySet()); // Get column names and types String columnNameProperty = tbl.getProperty(serdeConstants.LIST_COLUMNS); @@ -117,15 +114,15 @@ public class JsonSerDe extends AbstractSerDe { final String columnNameDelimiter = tbl.containsKey(serdeConstants.COLUMN_NAME_DELIMITER) ? tbl .getProperty(serdeConstants.COLUMN_NAME_DELIMITER) : String.valueOf(SerDeUtils.COMMA); // all table column names - if (columnNameProperty.length() == 0) { - columnNames = new ArrayList<String>(); + if (columnNameProperty.isEmpty()) { + columnNames = Collections.emptyList(); } else { columnNames = Arrays.asList(columnNameProperty.split(columnNameDelimiter)); } // all column types - if (columnTypeProperty.length() == 0) { - columnTypes = new ArrayList<TypeInfo>(); + if (columnTypeProperty.isEmpty()) { + columnTypes = Collections.emptyList(); } else { columnTypes = TypeInfoUtils.getTypeInfosFromTypeString(columnTypeProperty); } @@ -176,11 +173,9 @@ public class JsonSerDe extends AbstractSerDe { } } catch (JsonParseException e) { LOG.warn("Error [{}] parsing json text [{}].", e, t); - LOG.debug(null, e); throw new SerDeException(e); } catch (IOException e) { LOG.warn("Error [{}] parsing json text [{}].", e, t); - LOG.debug(null, e); throw new SerDeException(e); }
