fix: preserve cached rows matching a malformed UTF-8 prefix #7721
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 275 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.336
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7721"
general
weight: 0.35
viirya
Which issue does this PR close?
Part of #6834. This follows up on the cache pruning work in #5543 under #5487.
The draft backport to
branch-1.2is #7786.Rationale for this change
startswith(s, CAST(X'C3' AS STRING))matchesébecause Spark compares the prefix byteC3with the first byte ofC3 A9. Spark's cache pruner takes one character from each batch bound for this prefix. If the lower bound isé, that givesC3 A9, which sorts afterC3. The scan skips a matching batch before Spark can apply the row filter. All the cached strings can be valid UTF-8. Row comparison · Cache pruning ruleWhat changes are included in this PR?
When building the batch filter, Comet rewrites
startswithon a binary-collated string column with a malformed UTF-8 literal as a byte range. ForC3, every matching string falls in[C3, C4). Spark can skip a batch if its maximum is belowC3or its minimum is at leastC4, and combine those checks with other predicates underANDandOR. The originalstartswithevaluates the surviving rows.The exclusive upper bound comes from incrementing the last byte below
FFand truncating after it. For example, the upper bound forC3 FFisC4. An all-FFprefix needs only the lower bound.How are these changes tested?
CometInMemoryCachePruningSuitecompares the IDs returned bystartswith(s, CAST(X'C3' AS STRING)) OR id = 0against Spark's answer collected before caching. The expected result contains ID 0 and the four IDs whose string isé. The scan metric must report eight decoded rows, exactly the two relevant four-row batches out of sixteen. The suite exercises native Arrow, Spark columnar, and row inputs.A second SQL test caches raw strings and checks that prefixes
C3 FF FFandFF FFeach retain their matching row.git diff --checkand Spotless passed for the changed files. The SQL tests are submitted to hosted CI.