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-14290: Refactor HIVE-14054 to use Collections#newSetFromMap (Peter Slawski via Ashutosh Chauhan)
Date Wed, 31 Aug 2016 00:53:28 GMT
Repository: hive
Updated Branches:
  refs/heads/master ec4673bbc -> ab605910e


HIVE-14290: Refactor HIVE-14054 to use Collections#newSetFromMap (Peter Slawski 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/ab605910
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/ab605910
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/ab605910

Branch: refs/heads/master
Commit: ab605910e45cfa65b9895399f09194801f2cc091
Parents: ec4673b
Author: Peter Slawski <petersla@amazon.com>
Authored: Mon Jun 20 10:18:25 2016 -0700
Committer: Ashutosh Chauhan <hashutosh@apache.org>
Committed: Tue Aug 30 17:52:43 2016 -0700

----------------------------------------------------------------------
 .../hive/ql/metadata/HiveMetaStoreChecker.java      | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/ab605910/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreChecker.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreChecker.java b/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreChecker.java
index 34b76b8..13d9651 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreChecker.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/HiveMetaStoreChecker.java
@@ -379,9 +379,7 @@ public class HiveMetaStoreChecker {
   private void checkPartitionDirs(Path basePath, Set<Path> allDirs, int maxDepth) throws
IOException, HiveException {
     ConcurrentLinkedQueue<Path> basePaths = new ConcurrentLinkedQueue<>();
     basePaths.add(basePath);
-    // we only use the keySet of ConcurrentHashMap
-    // Neither the key nor the value can be null.
-    Map<Path, Object> dirSet = new ConcurrentHashMap<>();
+    Set<Path> dirSet = Collections.newSetFromMap(new ConcurrentHashMap<Path, Boolean>());
   
     // Here we just reuse the THREAD_COUNT configuration for
     // HIVE_MOVE_FILES_THREAD_COUNT
     final ExecutorService pool = conf.getInt(ConfVars.HIVE_MOVE_FILES_THREAD_COUNT.varname,
25) > 0 ? Executors
@@ -396,12 +394,12 @@ public class HiveMetaStoreChecker {
     }
     checkPartitionDirs(pool, basePaths, dirSet, basePath.getFileSystem(conf), maxDepth, maxDepth);
     pool.shutdown();
-    allDirs.addAll(dirSet.keySet());
+    allDirs.addAll(dirSet);
   }
 
   // process the basePaths in parallel and then the next level of basePaths
   private void checkPartitionDirs(final ExecutorService pool,
-      final ConcurrentLinkedQueue<Path> basePaths, final Map<Path, Object> allDirs,
+      final ConcurrentLinkedQueue<Path> basePaths, final Set<Path> allDirs,
       final FileSystem fs, final int depth, final int maxDepth) throws IOException, HiveException
{
     final ConcurrentLinkedQueue<Path> nextLevel = new ConcurrentLinkedQueue<>();
     if (null == pool) {
@@ -437,9 +435,7 @@ public class HiveMetaStoreChecker {
             }
           }
         } else {
-          // true is just a boolean object place holder because neither the
-          // key nor the value can be null.
-          allDirs.put(path, true);
+          allDirs.add(path);
         }
       }
     } else {
@@ -483,9 +479,7 @@ public class HiveMetaStoreChecker {
                 }
               }
             } else {
-              // true is just a boolean object place holder because neither the
-              // key nor the value can be null.
-              allDirs.put(path, true);
+              allDirs.add(path);
             }
             return null;
           }


Mime
View raw message