diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CacheUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CacheUtils.java index b438479..668499b 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CacheUtils.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CacheUtils.java @@ -103,7 +103,7 @@ public static boolean matches(String name, String pattern) { String[] subpatterns = pattern.trim().split("\\|"); for (String subpattern : subpatterns) { subpattern = "(?i)" + subpattern.replaceAll("\\?", ".{1}").replaceAll("\\*", ".*") - .replaceAll("\\^", "\\\\^").replaceAll("\\$", "\\\\$");; + .replaceAll("\\^", "\\\\^").replaceAll("\\$", "\\\\$"); if (Pattern.matches(subpattern, HiveStringUtils.normalizeIdentifier(name))) { return true; } diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java index a04fd5b..5a187d8 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java @@ -514,8 +514,8 @@ public boolean addPartitions(String dbName, String tblName, if (succ) { interruptCacheUpdateMaster(); for (Partition part : parts) { - SharedCache.addPartitionToCache(HiveStringUtils.normalizeIdentifier(dbName), - HiveStringUtils.normalizeIdentifier(tblName), part); + SharedCache.addPartitionToCache(HiveStringUtils.normalizeIdentifier(part.getDbName()), + HiveStringUtils.normalizeIdentifier(part.getTableName()), part); } } return succ; @@ -545,6 +545,8 @@ public Partition getPartition(String dbName, String tableName, HiveStringUtils.normalizeIdentifier(tableName), part_vals); if (part != null) { part.unsetPrivileges(); + } else { + throw new NoSuchObjectException(); } return part; } @@ -782,6 +784,7 @@ public boolean getPartitionsByExpr(String dbName, String tblName, byte[] expr, for (String partName : partNames) { Partition part = SharedCache.getPartitionFromCache(HiveStringUtils.normalizeIdentifier(dbName), HiveStringUtils.normalizeIdentifier(tblName), partNameToVals(partName)); + part.unsetPrivileges(); result.add(part); } return hasUnknownPartitions; @@ -1046,7 +1049,7 @@ public Partition getPartitionWithAuth(String dbName, String tblName, } } if (!psMatch) { - break; + continue; } if (maxParts == -1 || count < maxParts) { partNames.add(Warehouse.makePartName(t.getPartitionKeys(), part.getValues())); diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseUtils.java index 3172f92..7dfa38f 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseUtils.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/hbase/HBaseUtils.java @@ -653,7 +653,7 @@ private static ResourceType convertResourceTypes( } } if (sd.getBucketCols() != null) { - SortedSet bucketCols = new TreeSet<>(sd.getBucketCols()); + List bucketCols = new ArrayList<>(sd.getBucketCols()); for (String bucket : bucketCols) md.update(bucket.getBytes(ENCODING)); } if (sd.getSortCols() != null) { @@ -688,6 +688,7 @@ private static ResourceType convertResourceTypes( md.update(e.getValue().getBytes(ENCODING)); } } + md.update(sd.isStoredAsSubDirectories() ? "true".getBytes(ENCODING) : "false".getBytes(ENCODING)); } return md.digest();