From 5af337ffe3214a66e7dee16b704eb0a507d719b2 Mon Sep 17 00:00:00 2001 From: Gene Pang Date: Tue, 7 Jan 2025 10:50:24 -0800 Subject: [PATCH] cleanup --- .../org/apache/parquet/variant/Variant.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/parquet-variant/src/main/java/org/apache/parquet/variant/Variant.java b/parquet-variant/src/main/java/org/apache/parquet/variant/Variant.java index dfdb85b96e..d88c38f0df 100644 --- a/parquet-variant/src/main/java/org/apache/parquet/variant/Variant.java +++ b/parquet-variant/src/main/java/org/apache/parquet/variant/Variant.java @@ -320,11 +320,7 @@ private static void appendQuoted(StringBuilder sb, String str) { private static final DateTimeFormatter TIMESTAMP_NTZ_FORMATTER = new DateTimeFormatterBuilder() .append(DateTimeFormatter.ISO_LOCAL_DATE) .appendLiteral('T') - .appendValue(HOUR_OF_DAY, 2) - .appendLiteral(':') - .appendValue(MINUTE_OF_HOUR, 2) - .appendLiteral(':') - .appendValue(SECOND_OF_MINUTE, 2) + .appendPattern("HH:mm:ss") .appendFraction(MICRO_OF_SECOND, 6, 6, true) .toFormatter(Locale.US); @@ -339,13 +335,10 @@ private static void appendQuoted(StringBuilder sb, String str) { new DateTimeFormatterBuilder() .append(DateTimeFormatter.ISO_LOCAL_DATE) .appendLiteral('T') - .appendValue(HOUR_OF_DAY, 2) - .appendLiteral(':') - .appendValue(MINUTE_OF_HOUR, 2) - .appendLiteral(':') - .appendValue(SECOND_OF_MINUTE, 2) + .appendPattern("HH:mm:ss") .optionalStart() .appendFraction(MICRO_OF_SECOND, 0, 6, true) + .optionalEnd() .toFormatter(Locale.US); /** The format for a timestamp with time zone, truncating trailing microsecond zeros. */ @@ -354,8 +347,8 @@ private static void appendQuoted(StringBuilder sb, String str) { .appendOffset("+HH:MM", "+00:00") .toFormatter(Locale.US); - private static Instant microsToInstant(long timestamp) { - return Instant.EPOCH.plus(timestamp, ChronoUnit.MICROS); + private static Instant microsToInstant(long microsSinceEpoch) { + return Instant.EPOCH.plus(microsSinceEpoch, ChronoUnit.MICROS); } private static void toJsonImpl(byte[] value, byte[] metadata, int pos, StringBuilder sb,