maedhroz commented on code in PR #2540:
URL: https://github.com/apache/cassandra/pull/2540#discussion_r1289145819


##########
src/java/org/apache/cassandra/index/sai/disk/v1/sortedterms/SortedTermsWriter.java:
##########
@@ -90,30 +80,29 @@ public class SortedTermsWriter implements Closeable
      *
      * @param componentName the component name for the {@link SortedTermsMeta}
      * @param metadataWriter the {@link MetadataWriter} for storing the {@link 
SortedTermsMeta}
-     * @param termsData where to write the prefix-compressed terms data
+     * @param termsOutput where to write the prefix-compressed terms data
      * @param termsDataBlockOffsets  where to write the offsets of each block 
of terms data
-     * @param trieOutput where to write the trie that maps the terms to point 
ids
+     * @param blockShift the block shift that is used to determine the block 
size
      */
     public SortedTermsWriter(String componentName,
                              MetadataWriter metadataWriter,
-                             IndexOutput termsData,
+                             IndexOutput termsOutput,
                              NumericValuesWriter termsDataBlockOffsets,
-                             IndexOutputWriter trieOutput) throws IOException
+                             int blockShift) throws IOException
     {
         this.componentName = componentName;
         this.metadataWriter = metadataWriter;
-        this.trieOutput = trieOutput;
-        SAICodecUtils.writeHeader(this.trieOutput);
-        this.trieWriter = new 
IncrementalDeepTrieWriterPageAware<>(trieSerializer, 
trieOutput.asSequentialWriter());
-        SAICodecUtils.writeHeader(termsData);
-        this.termsOutput = termsData;
-        this.bytesStartFP = termsData.getFilePointer();
+        SAICodecUtils.writeHeader(termsOutput);
+        this.blockShift = blockShift;
+        this.blockMask = (1 << this.blockShift) - 1;
+        this.termsOutput = termsOutput;
+        this.termsOutput.writeVInt(blockShift);
+        this.bytesStartFP = termsOutput.getFilePointer();
         this.offsetsWriter = termsDataBlockOffsets;
     }
 
     /**
      * Appends a term at the end of the sequence.
-     * Terms must be added in lexicographic order.

Review Comment:
   Are they still added in unsigned byte-comparable order? If not, they'd have 
to be sorted again?



-- 
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]

Reply via email to