You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "AMashenkov (via GitHub)" <gi...@apache.org> on 2024/02/06 09:13:19 UTC

Re: [PR] IGNITE-21230 Custom serialization of catalog commands. [ignite-3]

AMashenkov commented on code in PR #3058:
URL: https://github.com/apache/ignite-3/pull/3058#discussion_r1479442662


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/descriptors/CatalogColumnCollation.java:
##########
@@ -70,4 +70,17 @@ public boolean asc() {
     public boolean nullsFirst() {
         return nullsFirst;
     }
+
+    /** Writes collation to byte. */
+    static byte pack(CatalogColumnCollation collation) {
+        return  (byte) ((collation.asc() ? 1 : 0) | (collation.nullsFirst() ? 2 : 0));
+    }
+
+    /** Reads collation from byte. */
+    static CatalogColumnCollation unpack(byte collationBits) {
+        boolean asc = (collationBits & 1) == 1;
+        boolean nullsFirst = (collationBits & 2) == 2;

Review Comment:
   Let's convert magic numbers to constants.



-- 
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: notifications-unsubscribe@ignite.apache.org

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