hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject hive git commit: HIVE-16880 : Remove ArrayList Instantiation For Empty Arrays (Beluga Behr via Ashutosh Chauhan)
Date Mon, 19 Jun 2017 16:47:00 GMT
Repository: hive
Updated Branches:
  refs/heads/master 314fe44e5 -> 8f0049970


HIVE-16880 : Remove ArrayList Instantiation For Empty Arrays (Beluga Behr via Ashutosh Chauhan)

Signed-off-by: Ashutosh Chauhan <hashutosh@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/8f004997
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8f004997
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8f004997

Branch: refs/heads/master
Commit: 8f004997025f032242a5b2db4c6baf9256e0ecbd
Parents: 314fe44
Author: BELUGA BEHR <dam6923@gmail.com>
Authored: Sat Jun 10 14:50:00 2017 -0800
Committer: Ashutosh Chauhan <hashutosh@apache.org>
Committed: Mon Jun 19 09:45:53 2017 -0700

----------------------------------------------------------------------
 .../hive/metastore/MetaStoreDirectSql.java      | 33 ++++++++++----------
 1 file changed, 17 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/8f004997/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
index 500fba9..b5308da 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
@@ -28,6 +28,7 @@ import java.sql.SQLException;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -351,13 +352,13 @@ class MetaStoreDirectSql {
   public List<Partition> getPartitionsViaSqlFilter(final String dbName, final String
tblName,
       List<String> partNames) throws MetaException {
     if (partNames.isEmpty()) {
-      return new ArrayList<Partition>();
+      return Collections.emptyList();
     }
     return runBatched(partNames, new Batchable<String, Partition>() {
       public List<Partition> run(List<String> input) throws MetaException {
         String filter = "\"PARTITIONS\".\"PART_NAME\" in (" + makeParams(input.size()) +
")";
         return getPartitionsViaSqlFilterInternal(dbName, tblName, null, filter, input,
-            new ArrayList<String>(), null);
+            Collections.emptyList(), null);
       }
     });
   }
@@ -402,7 +403,7 @@ class MetaStoreDirectSql {
   public List<Partition> getPartitions(
       String dbName, String tblName, Integer max) throws MetaException {
     return getPartitionsViaSqlFilterInternal(dbName, tblName, null,
-        null, new ArrayList<String>(), new ArrayList<String>(), max);
+        null, Collections.emptyList(), Collections.emptyList(), max);
   }
 
   private static Boolean isViewTable(Table t) {
@@ -482,7 +483,7 @@ class MetaStoreDirectSql {
     long queryTime = doTrace ? System.nanoTime() : 0;
     timingTrace(doTrace, queryText, start, queryTime);
     if (sqlResult.isEmpty()) {
-      return new ArrayList<Partition>(); // no partitions, bail early.
+      return Collections.emptyList(); // no partitions, bail early.
     }
 
     // Get full objects. For Oracle/etc. do it in batches.
@@ -726,7 +727,7 @@ class MetaStoreDirectSql {
           if (fields[1] == null) {
             currentList = null; // left outer join produced a list with no values
             currentListId = null;
-            t.getSkewedInfo().addToSkewedColValues(new ArrayList<String>());
+            t.getSkewedInfo().addToSkewedColValues(Collections.emptyList());
           } else {
             long fieldsListId = extractSqlLong(fields[1]);
             if (currentListId == null || fieldsListId != currentListId) {
@@ -1224,7 +1225,7 @@ class MetaStoreDirectSql {
       throws MetaException {
     if (colNames.isEmpty() || partNames.isEmpty()) {
       LOG.debug("Columns is empty or partNames is empty : Short-circuiting stats eval");
-      return new AggrStats(new ArrayList<ColumnStatisticsObj>(), 0); // Nothing to
aggregate
+      return new AggrStats(Collections.emptyList(), 0); // Nothing to aggregate
     }
     long partsFound = 0;
     List<ColumnStatisticsObj> colStatsList;
@@ -1365,11 +1366,11 @@ class MetaStoreDirectSql {
     query = pm.newQuery("javax.jdo.query.SQL", queryText);
     qResult =
         executeWithArray(query,
-            prepareParams(dbName, tblName, new ArrayList<String>(), new ArrayList<String>()),
+            prepareParams(dbName, tblName, Collections.emptyList(), Collections.emptyList()),
             queryText);
     if (qResult == null) {
       query.closeAll();
-      return Maps.newHashMap();
+      return Collections.emptyMap();
     }
     end = doTrace ? System.nanoTime() : 0;
     timingTrace(doTrace, queryText, start, end);
@@ -1453,7 +1454,7 @@ class MetaStoreDirectSql {
           queryText);
       if (qResult == null) {
         query.closeAll();
-        return Lists.newArrayList();
+        return Collections.emptyList();
       }
       end = doTrace ? System.nanoTime() : 0;
       timingTrace(doTrace, queryText, start, end);
@@ -1483,7 +1484,7 @@ class MetaStoreDirectSql {
       timingTrace(doTrace, queryText, start, end);
       if (qResult == null) {
         query.closeAll();
-        return Lists.newArrayList();
+        return Collections.emptyList();
       }
       List<String> noExtraColumnNames = new ArrayList<String>();
       Map<String, String[]> extraColumnNameTypeParts = new HashMap<String, String[]>();
@@ -1515,7 +1516,7 @@ class MetaStoreDirectSql {
             prepareParams(dbName, tableName, partNames, noExtraColumnNames), queryText);
         if (qResult == null) {
           query.closeAll();
-          return Lists.newArrayList();
+          return Collections.emptyList();
         }
         list = ensureList(qResult);
         for (Object[] row : list) {
@@ -1548,7 +1549,7 @@ class MetaStoreDirectSql {
             prepareParams(dbName, tableName, partNames, extraColumnNames), queryText);
         if (qResult == null) {
           query.closeAll();
-          return Lists.newArrayList();
+          return Collections.emptyList();
         }
         list = ensureList(qResult);
         // see the indexes for colstats in IExtrapolatePartStatus
@@ -1625,7 +1626,7 @@ class MetaStoreDirectSql {
                   prepareParams(dbName, tableName, partNames, Arrays.asList(colName)), queryText);
               if (qResult == null) {
                 query.closeAll();
-                return Lists.newArrayList();
+                return Collections.emptyList();
               }
               fqr = (ForwardQueryResult) qResult;
               Object[] min = (Object[]) (fqr.get(0));
@@ -1654,7 +1655,7 @@ class MetaStoreDirectSql {
                   prepareParams(dbName, tableName, partNames, Arrays.asList(colName)), queryText);
               if (qResult == null) {
                 query.closeAll();
-                return Lists.newArrayList();
+                return Collections.emptyList();
               }
               fqr = (ForwardQueryResult) qResult;
               Object[] avg = (Object[]) (fqr.get(0));
@@ -1716,7 +1717,7 @@ class MetaStoreDirectSql {
   public List<ColumnStatistics> getPartitionStats(final String dbName, final String
tableName,
       final List<String> partNames, List<String> colNames) throws MetaException
{
     if (colNames.isEmpty() || partNames.isEmpty()) {
-      return Lists.newArrayList();
+      return Collections.emptyList();
     }
     final boolean doTrace = LOG.isDebugEnabled();
     final String queryText0 = "select \"PARTITION_NAME\", " + STATS_COLLIST + " from "
@@ -1735,7 +1736,7 @@ class MetaStoreDirectSql {
             timingTrace(doTrace, queryText0, start, (doTrace ? System.nanoTime() : 0));
             if (qResult == null) {
               query.closeAll();
-              return Lists.newArrayList();
+              return Collections.emptyList();
             }
             addQueryAfterUse(query);
             return ensureList(qResult);


Mime
View raw message