This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new f828501b28 [hive] HiveCatalog should not delete dir for drop partition
(#5676)
f828501b28 is described below
commit f828501b28615412f72c9339339afdea12613f80
Author: Jingsong Lee <[email protected]>
AuthorDate: Fri May 30 09:57:46 2025 +0800
[hive] HiveCatalog should not delete dir for drop partition (#5676)
---
.../main/java/org/apache/paimon/hive/HiveCatalog.java | 18 ------------------
.../org/apache/paimon/hive/HiveCatalogITCaseBase.java | 8 ++++----
2 files changed, 4 insertions(+), 22 deletions(-)
diff --git
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
index bbcd645f20..e0f94d92da 100644
---
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
+++
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
@@ -395,9 +395,6 @@ public class HiveCatalog extends AbstractCatalog {
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 {
@@ -408,21 +405,6 @@ public class HiveCatalog extends AbstractCatalog {
identifier.getTableName(),
partitionValues,
false));
-
- if (!externalTable) {
- Path partitionLocation = new
Path(getPartitionLocation(dataFilePath, part));
- try {
- if (fileIO.exists(partitionLocation)) {
-
fileIO.deleteDirectoryQuietly(partitionLocation);
- }
- } catch (Exception ee) {
- LOG.error(
- "Delete directory[{}] fail for table {}
partition.",
- partitionLocation,
- identifier,
- ee);
- }
- }
} catch (NoSuchObjectException e) {
// do nothing if the partition not exists
} catch (Exception e) {
diff --git
a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
index 43027f5720..af5ad48a48 100644
---
a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
+++
b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
@@ -606,12 +606,12 @@ public abstract class HiveCatalogITCaseBase {
tEnv.executeSql("ALTER TABLE `t$branch_test` DROP PARTITION (pt = 3)");
assertThat(hiveShell.executeQuery("SHOW PARTITIONS t"))
.containsExactlyInAnyOrder("pt=1", "pt=2", "pt=4");
- assertThat(fileIO.exists(new Path(tablePath, "pt=3"))).isFalse();
+ assertThat(fileIO.exists(new Path(tablePath, "pt=3"))).isTrue();
tEnv.executeSql("ALTER TABLE t DROP PARTITION (pt = 1)");
assertThat(hiveShell.executeQuery("SHOW PARTITIONS t"))
.containsExactlyInAnyOrder("pt=2", "pt=4");
- assertThat(fileIO.exists(new Path(tablePath, "pt=1"))).isFalse();
+ assertThat(fileIO.exists(new Path(tablePath, "pt=1"))).isTrue();
tEnv.executeSql("ALTER TABLE t DROP PARTITION (pt = 4)");
assertThat(hiveShell.executeQuery("SHOW PARTITIONS t"))
@@ -620,11 +620,11 @@ public abstract class HiveCatalogITCaseBase {
tEnv.executeSql("ALTER TABLE `t$branch_test` DROP PARTITION (pt = 4)");
assertThat(hiveShell.executeQuery("SHOW PARTITIONS
t")).containsExactlyInAnyOrder("pt=2");
- assertThat(fileIO.exists(new Path(tablePath, "pt=4"))).isFalse();
+ assertThat(fileIO.exists(new Path(tablePath, "pt=4"))).isTrue();
tEnv.executeSql("ALTER TABLE t DROP PARTITION (pt = 2)");
assertThat(hiveShell.executeQuery("SHOW PARTITIONS t")).isEmpty();
- assertThat(fileIO.exists(new Path(tablePath, "pt=2"))).isFalse();
+ assertThat(fileIO.exists(new Path(tablePath, "pt=2"))).isTrue();
}
@Test