Skip to content

Commit

Permalink
[flink] Ignore PartitionNotExistException on drop if exists partition…
Browse files Browse the repository at this point in the history
… statement (apache#2617)
  • Loading branch information
zhoulii authored Jan 2, 2024
1 parent e733ed5 commit 09f0292
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,9 @@ public final void dropPartition(
throws PartitionNotExistException, CatalogException {

if (!partitionExists(tablePath, partitionSpec)) {
throw new PartitionNotExistException(getName(), tablePath, partitionSpec);
if (!ignoreIfNotExists) {
throw new PartitionNotExistException(getName(), tablePath, partitionSpec);
}
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,11 @@ public void testDropPartition() {
.hasMessage(
"Partition CatalogPartitionSpec{{dt=2020-10-10}} of table default.PartitionTable in catalog PAIMON does not exist.");

assertThat(
sql("ALTER TABLE PartitionTable DROP IF EXISTS PARTITION (`dt` = '2020-10-10')")
.toString())
.isEqualTo("[+I[OK]]");

List<Row> result = sql("SHOW PARTITIONS PartitionTable");
assertThat(result.toString())
.isEqualTo(
Expand Down

0 comments on commit 09f0292

Please sign in to comment.