Skip to content

Commit

Permalink
[HUDI-6902] Fix a test about timestamp format (#10606)
Browse files Browse the repository at this point in the history
  • Loading branch information
linliu-code committed Feb 2, 2024
1 parent b6642c6 commit ed6b072
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@
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;
Expand Down Expand Up @@ -815,7 +817,11 @@ public void testHoodieParquetInputFormatReadTimeType() throws IOException {
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());
Expand Down

0 comments on commit ed6b072

Please sign in to comment.