You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2023/05/09 11:01:36 UTC

[incubator-paimon] branch release-0.4 updated: [test] Fix unstable test: PartitionExpireTest.testFilterCommittedAfterExpiring

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch release-0.4
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git


The following commit(s) were added to refs/heads/release-0.4 by this push:
     new 3d9d7b0dd [test] Fix unstable test: PartitionExpireTest.testFilterCommittedAfterExpiring
3d9d7b0dd is described below

commit 3d9d7b0dd9a0fb9f0610da76b97f0a1cffb60fff
Author: JingsongLi <lz...@aliyun.com>
AuthorDate: Thu May 4 12:22:16 2023 +0800

    [test] Fix unstable test: PartitionExpireTest.testFilterCommittedAfterExpiring
---
 .../java/org/apache/paimon/operation/PartitionExpireTest.java    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/paimon-core/src/test/java/org/apache/paimon/operation/PartitionExpireTest.java b/paimon-core/src/test/java/org/apache/paimon/operation/PartitionExpireTest.java
index 7dae4405c..1b143150e 100644
--- a/paimon-core/src/test/java/org/apache/paimon/operation/PartitionExpireTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/operation/PartitionExpireTest.java
@@ -44,6 +44,7 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -148,16 +149,16 @@ public class PartitionExpireTest {
         ThreadLocalRandom random = ThreadLocalRandom.current();
 
         // prepare commits
-        int now =
-                Integer.parseInt(
-                        LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
+        LocalDate now = LocalDate.now();
         int preparedCommits = random.nextInt(20, 30);
 
         List<List<CommitMessage>> commitMessages = new ArrayList<>();
         Set<Long> notCommitted = new HashSet<>();
         for (int i = 0; i < preparedCommits; i++) {
             // ensure the partition will be expired
-            String f0 = String.valueOf(now - random.nextInt(10));
+            String f0 =
+                    now.minus(random.nextInt(10), ChronoUnit.DAYS)
+                            .format(DateTimeFormatter.ofPattern("yyyyMMdd"));
             String f1 = String.valueOf(random.nextInt(25));
             StreamTableWrite write = table.newWrite(commitUser);
             write.write(GenericRow.of(BinaryString.fromString(f0), BinaryString.fromString(f1)));