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

   ### Background
   
   Native Segment scans materialize PLAIN string predicate columns before 
evaluating LIKE. At that point the page decoder already has the decompressed 
bytes and the boundaries of each string.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Performance
   
   Problem Summary:
   
   A selective predicate such as `message LIKE '%needle%'` can discard most of 
the strings copied into the predicate column. The mutable BE setting 
`enable_plain_page_like_filter` lets the decoder check supported predicates 
before copying string bytes. It defaults to false. In the ASAN example below, 
the decoder avoided copying 44.73 MB of rejected characters.
   
   ### Details
   
   - **Change map:** 234 additions and 11 deletions in production code, 160 
lines of tests, and 33 lines of generated output. The page and column readers 
carry the filter and align the result with input rows. The Segment scan applies 
those results before evaluating remaining predicates and exposes profile 
counters for the work.
   - **Why it was slow:** The PLAIN batch reader copies the characters of every 
candidate value before LIKE can reject a row.
   - **Optimization:** Search the bytes already in the page, copy only the 
values that pass the check, and preserve the batch positions for Segment 
selection. The existing LIKE still evaluates surviving rows.
   - **Results:** On one Intel Xeon Platinum 8457C host, a 65,536-row fixture 
used the same ASAN binary with the setting toggled across eight alternating 
pairs after warm-up. These are median MySQL client wall times.
   
     | Workload | Off | On |
     |---|---:|---:|
     | Long strings, low match rate | 236.150 ms | 210.134 ms |
     | Long strings, high match rate | 310.510 ms | 365.223 ms |
     | Short strings, low match rate | 145.748 ms | 117.239 ms |
   
   - **Applicability and cost:** Applies to positive nonempty 
constant-substring LIKE predicates on native PLAIN VARCHAR and STRING values. 
The extra check and per-value copies can cost more at high match rates. The 
setting stays off by default.
   - **Behavior change:** Adds profile counters for PLAIN values checked, 
values rejected, and character bytes skipped. Query results match across modes.
   
   ### Testing
   
   - 55 targeted ASAN BE tests passed across the PLAIN and dictionary page 
suites, including `FilterBeforeMaterializingPlainStrings`.
   - The `test_plain_page_like_filter` regression suite passed. Eight SQL 
comparisons and an inverted-index sparse-read case returned matching results 
across modes. The query profile recorded 63,270 checked and 62,639 rejected 
PLAIN values when enabled.
   - A configuration smoke test returned the expected result for 12 queries 
during 24 runtime setting updates.
   
   ### Release note
   
   The optional BE setting `enable_plain_page_like_filter` can reduce string 
copying for selective constant-substring LIKE scans on native PLAIN pages.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: Yes (document the BE setting and its 
applicability in the configuration reference)
   - Pre-submission status: Partially verified: RELEASE performance has not 
been measured.
   
   ### AI Disclosure
   
   - Tool: Codex (GPT-6), with GPT-5.6 Luna for remote build and runtime 
verification
   - Generated: Code, tests, verification harnesses, and this description
   - Human review: not stated
   
   


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