diff --git a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/AskwangJavaITCase.java b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/AskwangJavaITCase.java index 27750acc89b2..04a35f3a6cdf 100644 --- a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/AskwangJavaITCase.java +++ b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/AskwangJavaITCase.java @@ -1,8 +1,14 @@ package org.apache.paimon.flink; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import org.apache.paimon.data.BinaryRow; import org.apache.paimon.fs.Path; import org.junit.jupiter.api.Test; +import java.time.Duration; +import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; import java.util.function.BinaryOperator; public class AskwangJavaITCase { @@ -29,4 +35,33 @@ public void testPathGetName() { String pos = path1.getName().substring(SNAPSHOT_PREFIX.length()); System.out.println(pos); } + + @Test + public void testAddCommitPartitionCache() { + Cache cache = CacheBuilder.newBuilder() + .expireAfterAccess(30, TimeUnit.MINUTES) + .maximumSize(300) + .softValues() + .build(); + + // askwang-todo: partition transform to BinaryRow + // paimon-0.9: AddPartitionCommitCallback#addPartition. cache的使用 + BinaryRow partition = null; + try { + Boolean added = cache.get(partition, new Callable() { + @Override + public Boolean call() throws Exception { + return false; + } + }); + if (added) { + // return + } +// client.addPartition(partition); + cache.put(partition, true); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + }