3333import static org .apache .paimon .CoreOptions .END_INPUT_CHECK_PARTITION_EXPIRE ;
3434import static org .apache .paimon .CoreOptions .PARTITION_EXPIRATION_STRATEGY ;
3535import static org .apache .paimon .CoreOptions .PARTITION_EXPIRATION_TIME ;
36+ import static org .apache .paimon .partition .CustomPartitionExpirationFactory .TABLE_EXPIRE_PARTITIONS ;
3637import static org .assertj .core .api .Assertions .assertThat ;
3738
3839class 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