Skip to content

Commit cbfcb0f

Browse files
committed
minor
1 parent 2f6f682 commit cbfcb0f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

paimon-core/src/test/java/org/apache/paimon/partition/PartitionExpireTableTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import static org.apache.paimon.CoreOptions.END_INPUT_CHECK_PARTITION_EXPIRE;
3434
import static org.apache.paimon.CoreOptions.PARTITION_EXPIRATION_STRATEGY;
3535
import static org.apache.paimon.CoreOptions.PARTITION_EXPIRATION_TIME;
36+
import static org.apache.paimon.partition.CustomPartitionExpirationFactory.TABLE_EXPIRE_PARTITIONS;
3637
import static org.assertj.core.api.Assertions.assertThat;
3738

3839
class PartitionExpireTableTest extends TableTestBase {
@@ -53,10 +54,15 @@ public void testCustomExpire() throws Exception {
5354
write(table, GenericRow.of(2, 2));
5455
assertThat(read(table)).containsExactlyInAnyOrder(GenericRow.of(1, 1), GenericRow.of(2, 2));
5556

56-
PartitionEntry expire = new PartitionEntry(BinaryRow.singleColumn(1), 1, 1, 1, 1);
57-
CustomPartitionExpirationFactory.TABLE_EXPIRE_PARTITIONS.put(
58-
table.options().get("path"), Collections.singletonList(expire));
59-
write(table, GenericRow.of(3, 3));
60-
assertThat(read(table)).containsExactlyInAnyOrder(GenericRow.of(3, 3), GenericRow.of(2, 2));
57+
String path = table.options().get("path");
58+
try {
59+
PartitionEntry expire = new PartitionEntry(BinaryRow.singleColumn(1), 1, 1, 1, 1);
60+
TABLE_EXPIRE_PARTITIONS.put(path, Collections.singletonList(expire));
61+
write(table, GenericRow.of(3, 3));
62+
assertThat(read(table))
63+
.containsExactlyInAnyOrder(GenericRow.of(3, 3), GenericRow.of(2, 2));
64+
} finally {
65+
TABLE_EXPIRE_PARTITIONS.remove(path);
66+
}
6167
}
6268
}

0 commit comments

Comments
 (0)