← Back to Pull requests

[fix](jdbc) Reject unsupported scan column types before execution #71242

Closed
unknown closed this pull request without merging on Dec 03, 2026 01:47 UTC
View on GitHub
unknown unknown commented on Dec 01, 2026 15:08 UTC
Author

Background

JDBC catalogs expose external schemas that can include types Doris cannot read. Queries such as COUNT() reference no source column, but a surviving scan still needs one column to preserve row counts. Logical column pruning and physical scan translation both select such fallback columns.

What problem does this PR solve?

Issue Number: None
Related PR: #41548 (introduced the constant-projection path), #71243 (original scan guards on branch-4.2)
PR Type: Bugfix

Problem Summary:

COUNT() over an unsupported-only PostgreSQL table can send UNSUPPORTED metadata to BE and abort it during descriptor construction. Reject those scans during logical validation, select readable fallback columns in both planning paths, and retain FE serialization and BE ingestion guards. Mixed schemas remain usable even when discarded subquery outputs contain unsupported types. Most changed lines add tests, including column-level authorization checks.

Details

  • Change map: 122 production lines (+115/-7), 558 test lines, and 45 generated result lines across 15 files. Most lines are tests. Read FE logical validation, fallback selection and authorization compatibility first, then physical fallback/serialization (104 FE lines total), followed by BE descriptor validation (18 lines).

  • Frequency: Always for a surviving column-free scan over an unsupported-only schema; PostgreSQL built-in oid, name, and regnamespace reproduce the original crash. Nested fallback selection failures were reproduced with logical-plan tests.

  • Root cause: Constant projections hide source columns from expression validation. Width-based fallback selection can choose unsupported nested types or inputs, and discarded expressions can make an unreadable key hide readable alternatives.

  • Why existing tests missed it: CountStarSmallestSlotTest and SlotDescriptorTest cover valid metadata; existing column-pruning and privilege tests lack unsupported fallback inputs. PostgreSQL catalog/type suites cover readable types and arrays containing NULL, without unsupported-only counts or column-restricted empty subqueries.

  • Fix: Check surviving catalog outputs, exclude recursively unsupported executable fallback candidates, validate serialized slots, and reject unsupported BE descriptors before datatype construction. Preserve a non-null fallback until later validation and keep the historical authorization selection policy, because privilege checks precede scan elimination. Legitimate NULL types remain accepted.

  • Other paths and branches: Shared planning and descriptor checks cover other external scans and older-FE requests in both deployment modes. The original guards have companion PR #71243 for branch-4.2; this review follow-up updates master only. branch-4.1 shares the original path and is not fixed here; other release branches were not checked.

  • Behavior change: Unsupported-only scans report an error instead of crashing BE. Supported candidates retain their width ordering; permissions retain their existing column requirements. No protocol or configuration changes.
  • Testing

  • Locally passed 57 FE tests, including nine new logical fallback tests, scan-slot validation, COUNT(*) ordering, column pruning, expression utilities, and the extended real-SQL privilege fixture. Targeted logical tests failed before the fallback fixes.

  • A non-root PostgreSQL regression reproduced the review follow-up's extra permission denial before separating authorization from executable pruning; the final suite passes the allowed query and still rejects an unauthorized projection.

  • PostgreSQL 15 suite test_pg_jdbc_unsupported_scan_types: 20 query expectations; actual result generation and comparison both passed without skips. Also covers supported projections, subquery aliases, source casts, eliminated scans, and queries after rejection.

  • The unfixed BE baseline aborted during datatype construction; the guarded candidate passed 16 descriptor tests under ASAN at 8f5b7d5. No BE code changed in this follow-up.
  • Notes for Reviewers

  • Keep the translator filter: scan tuples still expose unused schema columns after logical expression checks. Rejecting all-unsupported scans earlier does not remove unsupported columns from mixed schemas.

  • Nested unsupported types have logical-plan unit coverage; the PostgreSQL subquery cases check compatibility rather than reproduce nested unsupported mappings. Local review findings were fixed and re-reviewed before this update.
  • Release note

    JDBC queries that retain an unsupported scan column now report a descriptive error instead of crashing a BE. Queries using supported columns from mixed schemas continue to work.

    Check List (For Author)

  • Behavior changed: Yes (see Details)

  • Does this need documentation: No

  • Pre-submission status: Ready
  • AI Disclosure

  • Tool: Codex (GPT-6); GPT-6 Astra for local review.

  • Generated: Implementation, tests, and this description.

  • Human review: Not stated for this follow-up.

  • Prompts: Fix master and branch-4.2 with unit and regression coverage and resolve local review findings before submission. Then assess the master PR's review comments and implement necessary changes.
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: morrySnow Review duration: 2078m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #71242"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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.5% · Safe to merge
    20.5%
    Repository