maedhroz commented on code in PR #2540:
URL: https://github.com/apache/cassandra/pull/2540#discussion_r1289156338
##########
src/java/org/apache/cassandra/index/sai/disk/v1/sortedterms/SortedTermsWriter.java:
##########
@@ -152,20 +136,30 @@ private void writeTermData(BytesRef term) throws
IOException
}
else
{
- int prefixLength = StringHelper.bytesDifference(prevTerm.get(),
term);
- int suffixLength = term.length - prefixLength;
- assert suffixLength > 0: "terms must be unique";
-
+ int prefixLength = 0;
+ int suffixLength = 0;
+
+ // If the term is the same as the previous term then we use prefix
and suffix lengths of 0.
+ // This means that we store a byte of 0 and don't write any data
for the term.
+ if (compareTerms(prevTerm.get(), term) != 0)
Review Comment:
Oh, will `bytesDifference()` throw `IllegalArgumentException` if we do that?
--
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]