← Back to Pull requests

perf(parquet): read the inner mask at absolute offsets in dense RowSelection::and_then #11554

Open
unknown opened this pull request with 267 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 14, 2026 13:58 UTC
Author

Which issue does this PR close?

  • Part of #7458.
  • Rationale for this change

    and_then_dense_masks from #10968 keeps the not yet consumed bits of other in a u128 window and refills it in a while loop, and without pdep each word goes through the bit loops of bit_util::expand. Both cost per word even where the masks come in whole words, as they do after row group and page filters.

    What changes are included in this PR?

  • Each mask word reads its 64 bits of other from a 16-byte window at the running bit position (BitReader), so a word's read depends only on the position and consecutive words overlap. The main loop ends at the first read that would cross the end of other; the remaining words read from a zero-padded copy of the last 16 bytes. Output words go straight into a zeroed buffer.

  • Without bmi2, a mask word that is all set takes the next 64 bits as they are, and taken bits that are all clear or all set give 0 or the mask word, skipping expand. With bmi2 the plain pdep stays, the branches cost more than it.
  • Are these changes tested?

    test_dense_mask_and_then_mask_shapes compares and_then_dense_masks with a bit-by-bit reference over lengths from 1 to 8195, random offsets of both masks, random bits around the inner slice (so a read past either end shows), and random, run-shaped, all-set and sparse outer masks against random, run-shaped and constant inner masks. The existing tests pass with and without bmi2.

    row_selector benches on GitHub runners, main / this PR, median of three interleaved rounds, dense path only (the others are unchanged):

    | case | Neoverse-N2 | Apple M1 | EPYC 7763 | EPYC 9V74, x86-64-v3 |
    |---|---|---|---|---|
    | clustered, outer 75 to 99 % | 1.29 to 1.59x | 1.33 to 1.65x | 1.52 to 1.96x | 1.52 to 1.81x |
    | random, outer 99 % | 1.20 to 1.43x | 1.15 to 1.47x | 1.51 to 1.68x | 1.53 to 1.72x |
    | random, inner 99 % | 1.69 to 1.74x | 1.68 to 1.95x | 1.77 to 1.81x | 1.45 to 1.48x |
    | random, outer 75 to 80 %, inner 5 to 10 % | 1.04 to 1.07x | 1.01 to 1.17x | 1.10 to 1.14x | 1.43 to 1.49x |

    Are there any significant user-facing changes?

    No.

    Diff: 267 lines (+200 / -67) across 3 files Reviewer: alamb Review duration: 4094m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 267 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.334
    Real PR Conversation Timeline
    1 comments
    "Review active on #11554"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.0% · Safe to merge
    21.0%