diff --git standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java index b98b4b4005..556bf3e592 100644 --- standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -9058,15 +9058,26 @@ public AggrStats get_aggr_stats_for(String catName, String dbName, String tblNam return null; } + GetPartitionsFilterSpec fs = new GetPartitionsFilterSpec(); + fs.setFilterMode(PartitionFilterMode.BY_NAMES); + fs.setFilters(partNames); + GetPartitionsProjectionSpec ps = new GetPartitionsProjectionSpec(); + ps.setIncludeParamKeyPattern(StatsSetupConst.COLUMN_STATS_ACCURATE + '%'); + ps.setFieldList(Lists.newArrayList("writeId", "parameters", "values")); + List parts = getPartitionSpecsByFilterAndProjection(convertToTable(table), ps, fs); + // List parts = getPartitionsByNames(catName, dbName, tblName, partNames); + // Loop through the given "partNames" list // checking isolation-level-compliance of each partition column stats. - for (String partName : partNames) { - MPartition mpart = getMPartition( - catName, dbName, tblName, Warehouse.getPartValuesFromPartName(partName)); - if (!isCurrentStatsValidForTheQuery(mpart, writeIdList, false)) { - LOG.debug("The current metastore transactional partition column statistics " + - "for " + dbName + "." + tblName + "." + mpart.getPartitionName() + " is not valid " + - "for the current query."); + for (Partition part : parts) { + if (!isCurrentStatsValidForTheQuery(part, part.getWriteId(), writeIdList, false)) { + List partColNames = new ArrayList<>(table.getPartitionKeys().size()); + for (MFieldSchema col : table.getPartitionKeys()) { + partColNames.add(col.getName()); + } + LOG.debug("The current metastore transactional partition column statistics for " + dbName + + "." + tblName + "." + FileUtils.makePartName(partColNames, part.getValues()) + + " is not valid for the current query"); return null; } } @@ -12426,7 +12437,7 @@ public void dropWMPool(String resourcePlanName, String poolPath) if (poolHasChildren(resourcePlan, poolPath)) { throw new InvalidOperationException("Pool has children cannot drop."); } - query = pm.newQuery(MWMPool.class, "resourcePlan == rp && path.startsWith(poolPath)"); + query = pm.newQuery(MWMPool.class, "resourcePlan == rp && path.startsegitWith(poolPath)"); query.declareParameters("MWMResourcePlan rp, java.lang.String poolPath"); if (query.deletePersistentAll(resourcePlan, poolPath) != 1) { throw new NoSuchObjectException("Cannot delete pool: " + poolPath);