emkornfield commented on code in PR #3680:
URL: https://github.com/apache/parquet-java/pull/3680#discussion_r3672049192


##########
parquet-column/src/main/java/org/apache/parquet/schema/PrimitiveStringifier.java:
##########
@@ -266,6 +267,41 @@ Instant getInstant(long value) {
     }
   }
 
+  /**
+   * Stringifier implementation for timestamps that handles both int64 and 
FLBA(12) carriers.
+   * Values outside of Instant's supported range render as raw integers rather 
than human-readable
+   * timestamps.
+   */
+  private abstract static class TimestampStringifier extends DateStringifier {
+    private TimestampStringifier(String name, String format) {
+      super(name, format);
+    }
+
+    @Override
+    public String stringify(Binary value) {
+      if (value == null) {
+        return BINARY_NULL;
+      }
+      byte[] littleEndian = value.getBytesUnsafe();
+      byte[] bigEndian = new byte[littleEndian.length];
+      for (int i = 0; i < littleEndian.length; ++i) {
+        bigEndian[i] = littleEndian[littleEndian.length - 1 - i];
+      }
+      try {
+        BigInteger units = new BigInteger(bigEndian);
+        try {
+          return toFormattedString(getInstant(units));
+        } catch (ArithmeticException | DateTimeException e) {
+          return units.toString();
+        }
+      } catch (NumberFormatException e) {
+        return BINARY_INVALID;

Review Comment:
   what cases does this throw?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to