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 <vgumas...@hortonworks.com> Authored: Wed Aug 8 18:55:32 2018 -0700 Committer: Vaibhav Gumashta <vgumas...@hortonworks.com> 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<String> 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; }