Copilot commented on code in PR #5823: URL: https://github.com/apache/hive/pull/5823#discussion_r2106102187
########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java: ########## @@ -352,26 +354,29 @@ public void alterTable(RawStore msdb, Warehouse wh, String catName, String dbnam String oldTblLocPath = srcPath.toUri().getPath(); String newTblLocPath = dataWasMoved ? destPath.toUri().getPath() : null; - // also the location field in partition - parts = msdb.getPartitions(catName, dbname, name, -1); - for (Partition part : parts) { - String oldPartLoc = part.getSd().getLocation(); - if (dataWasMoved && oldPartLoc.contains(oldTblLocPath)) { - URI oldUri = new Path(oldPartLoc).toUri(); - String newPath = oldUri.getPath().replace(oldTblLocPath, newTblLocPath); - Path newPartLocPath = new Path(oldUri.getScheme(), oldUri.getAuthority(), newPath); - part.getSd().setLocation(newPartLocPath.toString()); - } - part.setDbName(newDbName); - part.setTableName(newTblName); - } // Do not verify stats parameters on a partitioned table. msdb.alterTable(catName, dbname, name, newt, null); int partitionBatchSize = MetastoreConf.getIntVar(handler.getConf(), MetastoreConf.ConfVars.BATCH_RETRIEVE_MAX); String catalogName = catName; // alterPartition is only for changing the partition location in the table rename if (dataWasMoved) { + PartitionsRequest req = new PartitionsRequest(newDbName, newTblName); + req.setCatName(catName); + req.setMaxParts((short) -1); Review Comment: Consider adding a brief comment explaining the rationale behind using -1 to indicate fetching all partitions to aid future maintainers. -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org