SavicStefan commented on code in PR #59669:
URL: https://github.com/apache/spark/pull/59669#discussion_r4574670299


##########
common/variant/src/main/java/org/apache/spark/types/variant/VariantBuilder.java:
##########
@@ -205,6 +205,313 @@ public static Variant pickAtPaths(Variant v, PickNode 
tree) {
     return builder.result();
   }
 
+  /**
+   * Return {@code v} in canonical form, or {@code v} itself if it is already 
canonical.
+   * <p>
+   * The variant binary encoding allows the same logical value to be encoded 
in several ways
+   * (dictionary order, unused keys, integer and offset widths, decimal scale, 
...). Canonical form
+   * picks one encoding per value, so that values which are equal under the 
variant equality rules
+   * have identical {@code value} and {@code metadata} bytes and can be 
compared, hashed and
+   * grouped bytewise. It is a Spark-internal normalization, not part of the 
variant spec, and
+   * nothing outside Spark is expected to produce or require it. Only valid 
variants are supported;
+   * malformed bytes fail with {@code MALFORMED_VARIANT} where they are 
detected.

Review Comment:
   added those errors that are not mentioned in the spec



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