smiklosovic commented on code in PR #4458:
URL: https://github.com/apache/cassandra/pull/4458#discussion_r2490064610
##########
src/java/org/apache/cassandra/db/compression/CompressionDictionary.java:
##########
@@ -281,4 +315,60 @@ public String toString()
'}';
}
}
+
+ /**
+ * The purpose of lightweight dictionary is to not carry the actual
dictionary bytes for performance reasons.
+ * Handy for situations when retrieval from the database does not need to
contain dictionary
+ * or the instatiation of a proper dictionary object is not desirable or
unnecessary for other,
+ * mostly performance-related, reasons.
+ */
+ class LightweightCompressionDictionary implements CompressionDictionary
+ {
+ private final DictId dictId;
+ private final int checksum;
+ private final int size;
+
+ public LightweightCompressionDictionary(DictId dictId, int checksum,
int size)
+ {
+ this.dictId = dictId;
+ this.checksum = checksum;
+ this.size = size;
+ }
+
+ @Override
+ public DictId dictId()
+ {
+ return dictId;
+ }
+
+ @Override
+ public byte[] rawDictionary()
+ {
+ return null;
Review Comment:
null is valid value to return when we just list dictionaries as no actual
data will be fetched from the database, we can return empty byte array for the
sake of not returning null here and the in the composite / converting logic on
listing I would return null if the value returned here is empty array.
Throwing an exception is not a good idea because it would complicate the
composite logic more unnecessarily.
--
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]