You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by yi...@apache.org on 2024/02/02 02:18:48 UTC
(hudi) branch master updated: [HUDI-6902] Fix a test about timestamp format (#10606)
This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new ed6b0727f0f [HUDI-6902] Fix a test about timestamp format (#10606)
ed6b0727f0f is described below
commit ed6b0727f0f004a20167bb4574d42d2bbc3ead48
Author: Lin Liu <14...@users.noreply.github.com>
AuthorDate: Thu Feb 1 18:18:41 2024 -0800
[HUDI-6902] Fix a test about timestamp format (#10606)
---
.../java/org/apache/hudi/hadoop/TestHoodieParquetInputFormat.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/hudi-hadoop-mr/src/test/java/org/apache/hudi/hadoop/TestHoodieParquetInputFormat.java b/hudi-hadoop-mr/src/test/java/org/apache/hudi/hadoop/TestHoodieParquetInputFormat.java
index d71055079c2..37d625a599f 100644
--- a/hudi-hadoop-mr/src/test/java/org/apache/hudi/hadoop/TestHoodieParquetInputFormat.java
+++ b/hudi-hadoop-mr/src/test/java/org/apache/hudi/hadoop/TestHoodieParquetInputFormat.java
@@ -67,12 +67,14 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Paths;
import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Date;
import java.util.List;
import static org.apache.hudi.common.table.timeline.TimelineMetadataUtils.serializeCommitMetadata;
@@ -815,7 +817,11 @@ public class TestHoodieParquetInputFormat {
Instant.ofEpochMilli(testTimestampLong), ZoneOffset.UTC);
assertEquals(Timestamp.valueOf(localDateTime).toString(), String.valueOf(writable.get()[0]));
} else {
- assertEquals(new Timestamp(testTimestampLong).toString(), String.valueOf(writable.get()[0]));
+ Date date = new Date();
+ date.setTime(testTimestampLong);
+ assertEquals(
+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(date),
+ String.valueOf(writable.get()[0]));
}
// test long
assertEquals(testTimestampLong * 1000, ((LongWritable) writable.get()[1]).get());