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