Vamsi-klu commented on PR #18891:
URL: https://github.com/apache/pinot/pull/18891#issuecomment-4912347954

   +1 to xiangfu0's DESC-order finding — the concrete producer is 
ReverseDocIdSetOperator.getNextBlock(), which fills the block from 
getReverseIntIterator(), so an ORDER BY <sortedCol> DESC selection feeds 
strictly descending doc ids into getValuesSV. With a descending block 
lo=docIds[0] is the max and hi=docIds[length-1] the min, so lo>hi: the dense 
guard (long)hi-lo+1==length goes negative and drops to the sparse branch, where 
advanceIfNeeded(lo) plus the `if (docId > hi) break` writes nothing — silent 
null/default for every row that has the path.
   
   One caveat on the suggested "scatter with true min/max" fix: it repairs the 
sparse branch (docIdToPos is order-independent) but does NOT fix the dense 
fast-path. A descending block is also gap-free, so with min/max it still 
satisfies the dense guard and then writes values[docId - lo], which assumes 
docIds[i] == lo + i — for [5,4,3,2,1] that lands doc 5's value at index 4 
instead of 0. So the dense branch should stay ascending-specific (e.g. also 
require docIds[0] <= docIds[length-1]) and fall back to sparse/mask otherwise.
   
   getValuesMV was left on the mask path, so only the SV fast-path regressed; a 
regression test projecting json_extract_index under ORDER BY <sortedCol> DESC 
would pin it directly (the current JsonIndexTest / 
JsonExtractIndexTransformFunctionTest only exercise ascending blocks, which is 
why CI stays green). The flattenedToDocIds / convertFlattenedDocIdsToDocIds 
RoaringBitmapWriter changes look correct — getDocId is monotonic over ascending 
flattened ids, so ordered append is valid there.


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