← Back to Pull requests

feat(sql): support CROSS JOIN syntax #7573

Closed
unknown closed this pull request without merging on Oct 16, 2026 00:29 UTC
View on GitHub
unknown unknown commented on Oct 03, 2026 10:15 UTC
Author

Changes Made

Support FROM a CROSS JOIN b in SQL, which previously failed with Unsupported join type: CrossJoin(None) even though comma joins already supported the same operation.

Handle CrossJoin(JoinConstraint::None) in plan_single_from using the existing cross_join builder and column-naming options, then continue processing subsequent joins.

Add tests for:

  • comma/CROSS JOIN equivalence

  • aliases and duplicate columns

  • chained joins

  • the aggregate CTE query from #7532
  • Ordinary JOIN still requires ON or USING.

    Validation

  • Rebuilt with make build.

  • DAFT_RUNNER=native .venv/bin/pytest -q tests/sql: 422 passed, 25 skipped.

  • Rust formatting, Ruff lint/format checks for the changed code, and git diff --check passed.
  • AI assistance was used for implementation and test preparation. I reviewed the planner change and test coverage and ran the checks above locally.

    Pre-existing column-resolution issue

    During validation, I found a pre-existing column-resolution bug involving mixed comma/explicit joins and duplicate column names:

    SELECT a.id AS ai, b.id AS bi, c.id AS ci
    FROM a, b CROSS JOIN c;
    

    With a.id = 10, b.id = 20, and c.id = 20, this returns (10, 10, 20) instead of (10, 20, 20).
    The same incorrect column binding reproduces on main with the already-supported FROM a, b JOIN c ON b.id = c.id, so it is not introduced by this change.

    This is related to the broader name-based column-reference and join-renaming problems described in #4270 (duplicate column names / ordinal column references roadmap). That roadmap does not document this exact reproducer. The column-resolution fix remains out of scope for this PR.

    Related Issues

    Closes #7554.
    Related to #7532 (TPC-H Q11 CROSS JOIN).

    Diff: 225 lines (+168 / -57) across 2 files Reviewer: easyrev Review duration: 18134m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 225 lines diff across 2 files
    0.37
    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.324
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7573"
    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: 36.9% (MEDIUM) · Higher = larger blast radius
    36.9%
    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: 14.6% · Safe to merge
    14.6%