chenhao-db commented on code in PR #55599:
URL: https://github.com/apache/spark/pull/55599#discussion_r3164330365


##########
common/variant/src/main/java/org/apache/spark/types/variant/VariantUtil.java:
##########
@@ -589,6 +590,80 @@ public static <T> T handleArray(byte[] value, int pos, 
ArrayHandler<T> handler)
     return handler.apply(size, offsetSize, offsetStart, dataStart);
   }
 
+  // Validate whether a variant is well-formed. Returns true if the variant is 
valid, false if it
+  // is malformed.
+  // Specifically, it returns true if and only if `toJson` doesn't throw an 
exception. The
+  // implementation also has the same structure as `toJson` (see 
`Variant.toJsonImpl`).

Review Comment:
   Updated comment, but the date time part in your comment is not really valid. 
A `long` microseconds value spans ±292,472 years from epoch, while `Instant`'s 
range is ±~1B years (`Instant.MIN/MAX` ≈ ±3.16e16 seconds), so 
`Instant.EPOCH.plus(long, MICROS)` cannot overflow for any `long` input.



-- 
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