maedhroz commented on code in PR #2409:
URL: https://github.com/apache/cassandra/pull/2409#discussion_r1228337628
##########
src/java/org/apache/cassandra/index/sai/utils/TypeUtil.java:
##########
@@ -130,6 +131,23 @@ public static ByteComparable max(ByteComparable a,
ByteComparable b)
return a == null ? b : (b == null || ByteComparable.compare(b, a,
ByteComparable.Version.OSS50) < 0) ? a : b;
}
+ /**
+ * Returns the value length for the given {@link AbstractType}, selecting
16 for types
+ * that officially use VARIABLE_LENGTH but are, in fact, of a fixed length.
+ */
+ public static int fixedSizeOf(AbstractType<?> type)
+ {
+ if (type.isValueLengthFixed())
+ return type.valueLengthIfFixed();
+ else if (isInetAddress(type))
+ return 16;
+ else if (isBigInteger(type))
+ return 20;
Review Comment:
nit: Replace 16 and 20 magic numbers w/ constants (see
https://github.com/apache/cassandra/pull/2409/files#r1227304071)
--
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]