to 3.0-dev: cherry-pick #24027 (fulltext single-keyword fast path and correctness fixes)#24102
Merged
heni02 merged 4 commits intomatrixorigin:3.0-devfrom Apr 15, 2026
Merged
Conversation
…ast path and correctness fixes) Port PR matrixorigin#24027 from main to 3.0-dev with API adaptation. **5 Correctness Fixes:** 1. SQL escape injection: escape backslashes before single quotes 2. Multi-row argument bug: use nthRow instead of hardcoded 0 3. aggcnt double-counting: increment only for new doc_ids 4. BM25 doc-length dedup: GROUP BY doc_id before COUNT/AVG 5. NULL doc-length: COALESCE prevents NULL from LEFT JOIN **Single-Keyword Fast Path:** - Bypass streaming pipeline for single TEXT/STAR keyword queries - SingleKeywordTopKSQL (TF-IDF) and SingleKeywordTopKBM25SQL - Score computation matches full pipeline precision **Memory Lifecycle Hardening:** - sort_topk: free evicted items immediately - streamingStarted guard in free() - resetRowState: proper per-row cleanup for multi-row invocations - normalizeDocID/outputDocID: single cache for binary<->string conversion **3.0-dev API adaptation:** - RunStreamingSql uses *process.Process (not *SqlProcess) - FulltextBloomFilter not available on 3.0-dev (removed bloom filter propagation) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes
Port of #24027 from main to 3.0-dev.
What this PR does / why we need it
Cherry-picks the fulltext optimization and correctness fixes from PR #24027 to the 3.0-dev branch.
5 Correctness Fixes
escape()now escapes backslashes before single quotes to prevent SQL string framing breakagev.GetStringAt(0)→v.GetStringAt(nthRow)— all rows in a batch were using row 0's argumentsGROUP BY doc_idwithMAX(pos)before COUNT/AVG to prevent duplicatesCOALESCE(dl.pos, 0)prevents NULL from LEFT JOINSingle-Keyword Fast Path
SingleKeywordTopKSQL(TF-IDF) andSingleKeywordTopKBM25SQLgenerate optimized SQLMemory Lifecycle Hardening
sort_topk: evicted items freed immediately (ranking) / all non-survivors freed (non-ranking)streamingStartedguard infree()prevents blocking on nil/unstarted channelsresetRowState: proper per-row cleanup for multi-row invocationsnormalizeDocID/outputDocID: single cache for binary↔string doc_id conversions3.0-dev API Adaptation
RunStreamingSqluses*process.Process(not*SqlProcess) on 3.0-devFulltextBloomFilternot available on 3.0-dev; bloom filter propagation test removedHow has this been tested?