nikolamand-db commented on code in PR #46180:
URL: https://github.com/apache/spark/pull/46180#discussion_r1606956472


##########
common/unsafe/src/main/java/org/apache/spark/sql/catalyst/util/CollationFactory.java:
##########
@@ -118,76 +119,433 @@ public Collation(
     }
 
     /**
-     * Constructor with comparators that are inherited from the given collator.
+     * Collation id is defined as 32-bit integer.
+     * We specify binary layouts for different classes of collations.
+     * Classes of collations are differentiated by most significant 3 bits 
(bit 31, 30 and 29),
+     * bit 31 being most significant and bit 0 being least significant.
+     * ---
+     * INDETERMINATE collation id binary layout:
+     * bit 31-0: 1
+     * INDETERMINATE collation id is equal to -1
+     * ---
+     * user-defined collation id binary layout:
+     * bit 31:   0
+     * bit 30:   1
+     * bit 29-0: undefined, reserved for future use
+     * ---
+     * UTF8_BINARY collation id binary layout:
+     * bit 31-22: zeroes
+     * bit 21-18: zeroes, reserved for space trimming
+     * bit 17-16: zeroes, reserved for version
+     * bit 15-3:  zeroes
+     * bit 2:     0, reserved for accent sensitivity
+     * bit 1:     0, reserved for uppercase and case-insensitive
+     * bit 0:     0 = case-sensitive, 1 = lowercase
+     * ---
+     * ICU collation id binary layout:
+     * bit 31-30: zeroes
+     * bit 29:    1
+     * bit 28-24: zeroes
+     * bit 23-22: zeroes, reserved for version

Review Comment:
   Thanks for catching this. I refactored the comment to unify bits used for 
versioning and space trimming in both `UTF8_BINARY` and ICU collations. Added 
bit-centric view as well.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to