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

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


The following commit(s) were added to refs/heads/master by this push:
     new 760aa5486 [core] Fix daily tagTotime parse error (#1791)
760aa5486 is described below

commit 760aa54864cadd4f8ad68fda20da88f2332e9596
Author: Fengyuanshen <[email protected]>
AuthorDate: Thu Aug 17 15:24:09 2023 +0800

    [core] Fix daily tagTotime parse error (#1791)
---
 .../src/main/java/org/apache/paimon/tag/TagAutoCreation.java     | 6 ++++++
 .../src/test/java/org/apache/paimon/tag/TagAutoCreationTest.java | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java 
b/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java
index 2a08695b3..81014ef6d 100644
--- a/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java
+++ b/paimon-core/src/main/java/org/apache/paimon/tag/TagAutoCreation.java
@@ -29,6 +29,7 @@ import javax.annotation.Nullable;
 
 import java.time.Duration;
 import java.time.Instant;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
@@ -280,6 +281,11 @@ public class TagAutoCreation {
         protected DateTimeFormatter formatter() {
             return DAY_FORMATTER;
         }
+
+        @Override
+        public LocalDateTime tagToTime(String tag) {
+            return LocalDate.parse(tag, formatter()).atStartOfDay();
+        }
     }
 
     private static class TwoHoursTagPeriodHandler extends BaseTagPeriodHandler 
{
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoCreationTest.java 
b/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoCreationTest.java
index c98d2e169..fe734c8d9 100644
--- a/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoCreationTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/tag/TagAutoCreationTest.java
@@ -158,7 +158,7 @@ public class TagAutoCreationTest extends 
PrimaryKeyTableTestBase {
     }
 
     @Test
-    public void testTagDaily() {
+    public void testTagDaily() throws Exception {
         Options options = new Options();
         options.set(TAG_AUTOMATIC_CREATION, TagCreationMode.WATERMARK);
         options.set(TAG_CREATION_PERIOD, TagCreationPeriod.DAILY);
@@ -173,6 +173,13 @@ public class TagAutoCreationTest extends 
PrimaryKeyTableTestBase {
         // test second create
         commit.commit(new ManifestCommittable(0, 
utcMills("2023-07-19T12:00:01")));
         assertThat(tagManager.tags().values()).containsOnly("2023-07-17", 
"2023-07-18");
+
+        // test newCommit create
+        commit.close();
+        commit = table.newCommit(commitUser).ignoreEmptyCommit(false);
+        commit.commit(new ManifestCommittable(0, 
utcMills("2023-07-20T12:00:01")));
+        assertThat(tagManager.tags().values())
+                .containsOnly("2023-07-17", "2023-07-18", "2023-07-19");
     }
 
     private long utcMills(String timestamp) {

Reply via email to