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/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 183c81df0 [core] TagsTable time_retained should be nullable
183c81df0 is described below

commit 183c81df03cb4ccea515ad8c5f37b2e1cea85ce5
Author: Jingsong <[email protected]>
AuthorDate: Sat May 4 10:11:09 2024 +0800

    [core] TagsTable time_retained should be nullable
---
 .../java/org/apache/paimon/table/system/TagsTable.java    | 15 ++++++++-------
 .../org/apache/paimon/table/system/TagsTableTest.java     |  8 ++++----
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/table/system/TagsTable.java 
b/paimon-core/src/main/java/org/apache/paimon/table/system/TagsTable.java
index 82fe629f0..5a179cfc1 100644
--- a/paimon-core/src/main/java/org/apache/paimon/table/system/TagsTable.java
+++ b/paimon-core/src/main/java/org/apache/paimon/table/system/TagsTable.java
@@ -61,6 +61,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 
 import static org.apache.paimon.catalog.Catalog.SYSTEM_TABLE_SPLITTER;
 
@@ -245,13 +246,13 @@ public class TagsTable implements ReadonlyTable {
                     
Timestamp.fromLocalDateTime(DateTimeUtils.toLocalDateTime(tag.timeMillis())),
                     tag.totalRecordCount(),
                     BinaryString.fromString(branches == null ? "[]" : 
branches.toString()),
-                    tag.getTagCreateTime() == null
-                            ? null
-                            : 
Timestamp.fromLocalDateTime(tag.getTagCreateTime()),
-                    BinaryString.fromString(
-                            tag.getTagTimeRetained() == null
-                                    ? ""
-                                    : tag.getTagTimeRetained().toString()));
+                    Optional.ofNullable(tag.getTagCreateTime())
+                            .map(Timestamp::fromLocalDateTime)
+                            .orElse(null),
+                    Optional.ofNullable(tag.getTagTimeRetained())
+                            .map(Object::toString)
+                            .map(BinaryString::fromString)
+                            .orElse(null));
         }
     }
 }
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/table/system/TagsTableTest.java 
b/paimon-core/src/test/java/org/apache/paimon/table/system/TagsTableTest.java
index ea7aca67c..a1b7770c5 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/table/system/TagsTableTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/table/system/TagsTableTest.java
@@ -135,10 +135,10 @@ class TagsTableTest extends TableTestBase {
                             tag.getTagCreateTime() == null
                                     ? null
                                     : 
Timestamp.fromLocalDateTime(tag.getTagCreateTime()),
-                            BinaryString.fromString(
-                                    tag.getTagTimeRetained() == null
-                                            ? ""
-                                            : 
tag.getTagTimeRetained().toString())));
+                            tag.getTagTimeRetained() == null
+                                    ? null
+                                    : BinaryString.fromString(
+                                            
tag.getTagTimeRetained().toString())));
         }
         return internalRows;
     }

Reply via email to