pranavshenoy commented on code in PR #4909:
URL: https://github.com/apache/cassandra/pull/4909#discussion_r3541176268
##########
src/java/org/apache/cassandra/index/sai/disk/v1/trie/LiteralIndexWriter.java:
##########
@@ -69,7 +94,40 @@ public SegmentMetadata.ComponentMetadataMap
writeCompleteSegment(Iterator<IndexE
IndexEntry indexEntry = iterator.next();
try (PostingList postings = indexEntry.postingList)
{
- long offset = postingsWriter.write(postings);
+ if (!prefixEnabled)
+ {
+ long offset = postingsWriter.write(postings);
+ termsDictionaryWriter.add(indexEntry.term, offset);
+ continue;
+ }
+
+ // V2: the posting list emits exactCount, totalCount, then
exact rows followed by prefix rows.
+ int exactCount = (int) postings.nextPosting();
+ int totalCount = (int) postings.nextPosting();
+ int prefixCount = totalCount - exactCount;
+
+ boolean isTerminal = exactCount > 0;
+ boolean writePrefixSection = prefixCount >= minimumLeaves;
+
+ if (!isTerminal && !writePrefixSection)
+ {
+ // Pure intermediate node below the prefix threshold:
no on-disk entry (descent will reach leaves).
+ drain(postings, totalCount);
+ continue;
+ }
+
+ int[] exactRows = drainSortedInts(postings, exactCount);
+
+ int[] prefixRows = null;
+ if (writePrefixSection && prefixCount > 0)
+ prefixRows = drainSortedInts(postings, prefixCount);
Review Comment:
TODO: see if we can guarentee both exact list and prefix list are already
sorted
--
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]