Skip to content

Commit

Permalink
fix ut error
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuangchong committed Feb 7, 2025
1 parent 523d33f commit 7ba1a3e
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,8 @@ public void createPartitions(Identifier identifier, List<Map<String, String>> pa
}

int currentTime = (int) (System.currentTimeMillis() / 1000);
String dataFilePath = getDataFilePath(tableIdentifier, hmsTable);
StorageDescriptor sd = hmsTable.getSd();
String dataFilePath = getDataFilePath(tableIdentifier, hmsTable);
List<Partition> hivePartitions = new ArrayList<>();
for (Map<String, String> partitionSpec : partitions) {
Partition hivePartition = new Partition();
Expand Down Expand Up @@ -391,25 +391,24 @@ public void dropPartitions(Identifier identifier, List<Map<String, String>> part
tagToPart
? partitions
: removePartitionsExistsInOtherBranches(identifier, partitions);
Table hmsTable = getHmsTable(identifier);
boolean externalTable = isExternalTable(hmsTable);
String dataFilePath = getDataFilePath(identifier, hmsTable);
for (Map<String, String> part : metaPartitions) {
List<String> partitionValues = new ArrayList<>(part.values());
try {
Partition partition =
clients.run(
client ->
client.getPartition(
identifier.getDatabaseName(),
identifier.getTableName(),
partitionValues));
String partitionLocation = locationHelper.getPartitionLocation(partition);
locationHelper.dropPathIfRequired(new Path(partitionLocation), fileIO);
clients.execute(
client ->
client.dropPartition(
identifier.getDatabaseName(),
identifier.getTableName(),
partitionValues,
false));

if (!externalTable) {
String partitionLocation = getPartitionLocation(dataFilePath, part);
locationHelper.dropPathIfRequired(new Path(partitionLocation), fileIO);
}
} catch (NoSuchObjectException e) {
// do nothing if the partition not exists
} catch (Exception e) {
Expand Down

0 comments on commit 7ba1a3e

Please sign in to comment.