dengzhhu653 commented on code in PR #6935:
URL: https://github.com/apache/hive/pull/6935#discussion_r4748038550
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java:
##########
@@ -361,32 +360,25 @@ public void alterTable(RawStore msdb, Warehouse wh,
String catName, String dbnam
// 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);
- parts = handler.get_partitions_req(req).getPartitions();
-
- for (Partition part : parts) {
- String oldPartLoc = part.getSd().getLocation();
- if (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());
+ TableName renamedTable = new TableName(catalogName, newDbName,
newTblName);
+ PartitionsIterable partitionBatches = PartitionsIterable.create(
+ msdb, renamedTable, partitionBatchSize);
+ for (List<Partition> parts : partitionBatches) {
Review Comment:
ack, added a new testRenameTableAcrossBatches in
TestTablesCreateDropAlterTruncate
--
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]