dengzhhu653 commented on code in PR #5929:
URL: https://github.com/apache/hive/pull/5929#discussion_r2462637995


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java:
##########
@@ -9605,23 +9608,28 @@ public Map<String, String> 
updatePartitionColumnStatistics(Table table, MTable m
       List<ColumnStatisticsObj> statsObjs = colStats.getStatsObj();
       ColumnStatisticsDesc statsDesc = colStats.getStatsDesc();
       String catName = statsDesc.isSetCatName() ? statsDesc.getCatName() : 
getDefaultCatalog(conf);
-      Partition partition = convertToPart(catName, statsDesc.getDbName(), 
statsDesc.getTableName(), getMPartition(
-          catName, statsDesc.getDbName(), statsDesc.getTableName(), partVals, 
mTable), TxnUtils.isAcidTable(table));
+      MPartition mPartition = getMPartition(
+          catName, statsDesc.getDbName(), statsDesc.getTableName(), partVals, 
mTable);
+      Partition partition = convertToPart(catName, statsDesc.getDbName(), 
statsDesc.getTableName(),
+          mPartition, TxnUtils.isAcidTable(table));
       List<String> colNames = new ArrayList<>();
 
       for(ColumnStatisticsObj statsObj : statsObjs) {
         colNames.add(statsObj.getColName());
       }
 
-      Map<String, MPartitionColumnStatistics> oldStats = 
getPartitionColStats(table, statsDesc
-          .getPartName(), colNames, colStats.getEngine());
-
-      MPartition mPartition = getMPartition(
-          catName, statsDesc.getDbName(), statsDesc.getTableName(), partVals, 
mTable);
-      if (partition == null) {
+      List<Long> partitionIds = 
directSql.getPartitionFieldsViaSqlFilter(catName, statsDesc.getDbName(), 
statsDesc.getTableName(),
+          Arrays.asList("\"PART_ID\""), "\"PARTITIONS\".\"PART_NAME\" = ?",
+          Arrays.asList(Warehouse.makePartName(table.getPartitionKeys(), 
partVals)), Collections.emptyList(), -1);
+      if (partition == null || partitionIds.isEmpty()) {
         throw new NoSuchObjectException("Partition for which stats is gathered 
doesn't exist.");
       }
 
+      Map<String, MPartitionColumnStatistics> oldStats = 
getPartitionColStats(table, statsDesc
+          .getPartName(), colNames, colStats.getEngine());
+      lockForUpdate("PARTITIONS", "PART_ID", Optional.of("\"PART_ID\" = " + 
partitionIds.getFirst()));

Review Comment:
   change it to look up the partition by primary key



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to