← Back to Pull requests

feat(spark): implement Spark-compatible lower and lcase #398

Open
unknown opened this pull request with 198 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 22, 2026 05:23 UTC
Author

Which issue does this PR close?

Closes #207.

Rationale for this change

Spark features currently use DataFusion's lower, which rejects binary input, and do not register lcase. Spark accepts both names and decodes malformed binary input with replacement before lowercasing.

What changes are included in this PR?

  • Register lower and its lcase alias with shared Spark input coercion.

  • Reuse DataFusion's Unicode mapping and the existing UTF-8 repair kernel for binary input.

  • Preserve string layouts and input nullability; add regression tests and generated documentation.
  • This targets UTF8_BINARY with Spark 4.2's default case mappings. Locale-specific collations and the JVM fallback are outside this PR. Remaining implicit CAST formatting differences are tracked by #88.

    Are these changes tested?

    lower.slt and lcase.slt cover scalar/column input, all string layouts, dictionaries, ASCII and Unicode, contextual sigma, dotted-I expansion, supplementary characters, NULLs, binary decoding and both ANSI modes. A unit test checks return layout and nullability. The Spark 4.2.0 runner passes all 103 comparable records; ten runner-specific records are skipped, with no expected failures.

    Formatting, workspace Clippy, 596 library tests, five documentation tests, all 516 SQL test runs and documentation generation pass.

    Are there any user-facing changes?

    Spark mode now provides lcase and accepts binary input for both names, including malformed UTF-8. Existing Unicode lowercase behavior is pinned by Spark-verified tests.

    Diff: 198 lines (+148 / -50) across 2 files Reviewer: andygrove Review duration: 12174m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.36) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 198 lines diff across 2 files
    0.36
    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%
    42%
    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.317
    Real PR Conversation Timeline
    1 comments
    "Review active on #398"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% 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: 36.1% (MEDIUM) · Higher = larger blast radius
    36.1%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 20.6% · Safe to merge
    20.6%