airborne12 commented on code in PR #70968:
URL: https://github.com/apache/doris/pull/70968#discussion_r4691749813


##########
be/src/storage/index/inverted/snii/writer/logical_index_writer.cpp:
##########
@@ -936,9 +936,10 @@ Status LogicalIndexWriter::prepare_build(io::FileWriter* 
posting_out) {
 
 Status LogicalIndexWriter::build_norms_section() {
     // Sparse norms drop the bytes of the NULL rows, and store a norm that 
every row shares once.
-    // Writers keep dense norms; this debug point lets tests choose between 
the two forms.
-    bool consider_sparse = false;
-    DBUG_EXECUTE_IF("LogicalIndexWriter::finalize_build.sparse_norms", { 
consider_sparse = true; });
+    // This debug point keeps dense norms, for tests that compare the two 
forms.
+    bool consider_sparse = true;

Review Comment:
   Confirmed and fixed in 91051d3f3d4. Each index is laid out as postings, 
dictionary, norms, null bitmap and bloom filter, and the bloom filter is 
written whenever the index has a term, so the only index whose sparse norms 
were last is one without NULL rows and without terms (every row empty), where 
all rows share one norm.
   
   `build_norms_section` now considers sparse norms only when `null_docids_` or 
`term_hashes_` is not empty, that is when the null bitmap or the bloom filter 
follows the norms. A rewrite by a BE that predates #70883 copies up to the end 
of those sections, so it keeps the sparse norms. An index without NULL rows and 
without terms keeps dense norms.
   
   - `SniiSparseNormsTest.NormsThatWouldEndTheIndexStayDense` failed before the 
fix (a 10-byte sparse section with no null bitmap and no bloom filter after it) 
and passes after it.
   - `SniiSparseNormsTest.OlderRewritersCopyTheSparseSection` checks, for the 
corpora that keep sparse norms, that the end of the sections an older BE knows 
covers the sparse section.
   - The related BE UT suites pass (1751 tests).
   



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