HappenLee opened a new pull request, #71143:
URL: https://github.com/apache/doris/pull/71143

   ### Background
   
   The condition cache remembers which ranges of a segment had no matching 
rows. A later scan with the same predicate digest can skip those ranges.
   
   ### What problem does this PR solve?
   
   Issue Number: None  
   Related PR: None  
   PR Type: Bugfix
   
   Problem Summary: A typed NULL and INT 0 both contributed four zero bytes to 
the predicate digest. A query comparing a column with a CASE expression that 
returned NULL could therefore warm the cache with an empty result. A subsequent 
query comparing the same column with a CASE expression returning 0 could skip 
matching rows.
   
   Compute the digest of a top-level NULL literal from an empty payload, mixing 
its primitive type into the incoming seed. The type distinguishes it from an 
empty string and other typed NULLs. Each scalar literal still takes one hash, 
and non-NULL values use the existing column hash.
   
   ### Testing
   
   - BE unit tests exercise NULL vs zero, a nullable non-NULL zero, typed 
NULLs, an empty string, and the position of NULL among sibling expressions. The 
added test fails on the original implementation. All seven tests in 
VLiteralDigestTest pass with the fix, including the existing cache bypass for 
unsupported columns.
   - The SQL regression warms the condition cache with the NULL predicate, then 
checks the zero predicate with the condition cache on and off. Both returned 
IDs 3 and 7 on a local ASAN BE. Repeating the zero predicate returned 3 and 7 
again and the BE recorded a condition cache hit.
   - A local check using the bundled XXH3 compared the old and new inputs 
across 65,536 seeds. The old inputs for INT NULL and zero had equal digests for 
all 65,536. The new inputs had equal digests for none.
   
   ### Release note
   
   Fix missing rows when an earlier query populates the condition cache with a 
predicate containing a NULL literal and a later predicate uses INT 0.
   
   ### Check List (For Author)
   
   - Test: BE unit test and SQL regression.
   - Behavior changed: Yes. A warm cache now returns the same matching rows as 
an uncached scan for this case.
   - Does this need documentation: No
   - Pre-submission status: Ready
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex
   - Generated: Implementation, tests, and PR description.
   - Human review: The contributor discussed the root cause and the use of the 
primitive type in the digest. Code review requested.
   


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