hive git commit: HIVE-20337: CachedStore: getPartitionsByExpr is not populating the partition list correctly (Vaibhav Gumashta, reviewed by Daniel Dai)

2018-08-08 Thread vgumashta
Repository: hive
Updated Branches:
  refs/heads/branch-3 4d18b792c -> 18b5c8b8d


HIVE-20337: CachedStore: getPartitionsByExpr is not populating the partition 
list correctly (Vaibhav Gumashta, reviewed by Daniel Dai)


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

Branch: refs/heads/branch-3
Commit: 18b5c8b8d5edb2ba45775430484a08cfe52c5da3
Parents: 4d18b79
Author: Vaibhav Gumashta 
Authored: Wed Aug 8 18:55:32 2018 -0700
Committer: Vaibhav Gumashta 
Committed: Wed Aug 8 19:01:30 2018 -0700

--
 .../hadoop/hive/metastore/cache/CachedStore.java | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/18b5c8b8/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
--
diff --git 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
index 54c833d..2b03d87 100644
--- 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
+++ 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
@@ -1247,18 +1247,21 @@ public class CachedStore implements RawStore, 
Configurable {
 dbName = StringUtils.normalizeIdentifier(dbName);
 tblName = StringUtils.normalizeIdentifier(tblName);
 if (!shouldCacheTable(catName, dbName, tblName)) {
-  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts,
-  result);
+  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts, result);
 }
 List partNames = new LinkedList<>();
 Table table = sharedCache.getTableFromCache(catName, dbName, tblName);
 if (table == null) {
   // The table is not yet loaded in cache
-  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts,
-  result);
+  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts, result);
+}
+boolean hasUnknownPartitions =
+getPartitionNamesPrunedByExprNoTxn(table, expr, defaultPartitionName, 
maxParts, partNames, sharedCache);
+for (String partName : partNames) {
+  Partition part = sharedCache.getPartitionFromCache(catName, dbName, 
tblName, partNameToVals(partName));
+  part.unsetPrivileges();
+  result.add(part);
 }
-boolean hasUnknownPartitions = getPartitionNamesPrunedByExprNoTxn(table, 
expr,
-defaultPartitionName, maxParts, partNames, sharedCache);
 return hasUnknownPartitions;
   }
 



hive git commit: HIVE-20337: CachedStore: getPartitionsByExpr is not populating the partition list correctly (Vaibhav Gumashta, reviewed by Daniel Dai)

2018-08-08 Thread vgumashta
Repository: hive
Updated Branches:
  refs/heads/master 3f3d9189f -> 3a649b6d0


HIVE-20337: CachedStore: getPartitionsByExpr is not populating the partition 
list correctly (Vaibhav Gumashta, reviewed by Daniel Dai)


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

Branch: refs/heads/master
Commit: 3a649b6d048a002e1a79588bd329b21eb7df419a
Parents: 3f3d918
Author: Vaibhav Gumashta 
Authored: Wed Aug 8 18:55:32 2018 -0700
Committer: Vaibhav Gumashta 
Committed: Wed Aug 8 18:55:32 2018 -0700

--
 .../hadoop/hive/metastore/cache/CachedStore.java | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/3a649b6d/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
--
diff --git 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
index f73047f..1d53244 100644
--- 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
+++ 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
@@ -1258,18 +1258,21 @@ public class CachedStore implements RawStore, 
Configurable {
 dbName = StringUtils.normalizeIdentifier(dbName);
 tblName = StringUtils.normalizeIdentifier(tblName);
 if (!shouldCacheTable(catName, dbName, tblName)) {
-  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts,
-  result);
+  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts, result);
 }
 List partNames = new LinkedList<>();
 Table table = sharedCache.getTableFromCache(catName, dbName, tblName);
 if (table == null) {
   // The table is not yet loaded in cache
-  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts,
-  result);
+  return rawStore.getPartitionsByExpr(catName, dbName, tblName, expr, 
defaultPartitionName, maxParts, result);
+}
+boolean hasUnknownPartitions =
+getPartitionNamesPrunedByExprNoTxn(table, expr, defaultPartitionName, 
maxParts, partNames, sharedCache);
+for (String partName : partNames) {
+  Partition part = sharedCache.getPartitionFromCache(catName, dbName, 
tblName, partNameToVals(partName));
+  part.unsetPrivileges();
+  result.add(part);
 }
-boolean hasUnknownPartitions = getPartitionNamesPrunedByExprNoTxn(table, 
expr,
-defaultPartitionName, maxParts, partNames, sharedCache);
 return hasUnknownPartitions;
   }