Skip to content

fix(parser): report missing outer join conditions - #25880

Merged
XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/takeover-24772-outer-join-parser
Jul 20, 2026
Merged

XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/takeover-24772-outer-join-parser

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #24737

What this PR does / why we need it:

This PR continues the unfinished work from #24772 while preserving its original commits and authorship.

The inherited change allowed LEFT/RIGHT/FULL OUTER JOIN without ON or USING. Review established that this is not valid MySQL outer-join syntax and that conditionless JOIN semantics should remain limited to inner/cross-product forms.

The implementation now:

  • keeps ON or USING mandatory for LEFT, RIGHT, and FULL OUTER JOIN;
  • returns the explicit parser error outer join requires ON/USING clause when the condition is missing;
  • continues accepting ordinary JOIN, INNER JOIN, CROSS JOIN, STRAIGHT_JOIN, and NATURAL OUTER JOIN without an explicit condition where their grammar permits it;
  • removes the inherited positive BVT cases that executed conditionless outer joins;
  • covers LEFT/RIGHT/FULL, derived-table, trailing-clause, chained-join, valid ON/USING, and adjacent join semantics.

Validation

  • regenerated mysql_sql.go from mysql_sql.y with zero parser conflicts
  • verified parser generation is deterministic (make -B -C pkg/sql/parsers/dialect/mysql mysql_sql.go leaves no diff)
  • go test -count=1 -run '^TestOuterJoinRequiresCondition$' ./pkg/sql/parsers/dialect/mysql
  • go test -race -count=10 -run '^TestOuterJoinRequiresCondition$' ./pkg/sql/parsers/dialect/mysql
  • go test -count=1 ./pkg/sql/parsers/...
  • go vet ./pkg/sql/parsers/...
  • git diff --check

ULookup and others added 9 commits June 1, 2026 23:29
Change `join_condition` to `join_condition_opt` in the outer_join grammar
production so LEFT/RIGHT/FULL JOIN works without an explicit ON/USING
clause, matching INNER JOIN behavior and MySQL compatibility.

Fixes matrixorigin#24737
…ql_sql.y

PR matrixorigin#24772 (fix/issue-24737-prisma-relation-joins) -- the .y grammar file
merged cleanly; the generated .go file conflict was resolved by
re-running goyacc.
LEFT JOIN without ON was already covered; add RIGHT JOIN variant
to verify all outer join types parse correctly without ON/USING.
# Conflicts:
#	pkg/sql/parsers/dialect/mysql/mysql_sql.go
@mergify

mergify Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

⚠️ The sha of the head commit of this PR conflicts with #24772. Mergify cannot evaluate rules on this PR. Once #24772 is merged or closed, Mergify will resume processing this PR. ⚠️

@matrix-meow matrix-meow added the size/XXL Denotes a PR that changes 2000+ lines label Jul 20, 2026
@VioletQwQ-0 VioletQwQ-0 changed the title fix(parser): allow LEFT/RIGHT/FULL JOIN without ON/USING clause fix(parser): report missing outer join conditions Jul 20, 2026
@VioletQwQ-0
VioletQwQ-0 marked this pull request as ready for review July 20, 2026 05:05
@VioletQwQ-0
VioletQwQ-0 requested a review from XuPeng-SH as a code owner July 20, 2026 05:05
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-20 11:55 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-07-20 13:35 UTC · at deeb5cdcf305217fe76ccab78cd35af27f835af4

This pull request spent 1 hour 39 minutes 59 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

This pull request seems to come from a fork, and Mergify needs the author's permission to update its branch.
The author needs to enable "Allow edits from maintainers" on this pull request, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 8a2b975 into matrixorigin:main Jul 20, 2026
23 of 24 checks passed
@mergify mergify Bot added dequeued and removed queued labels Jul 20, 2026
@VioletQwQ-0
VioletQwQ-0 deleted the codex/takeover-24772-outer-join-parser branch July 22, 2026 08:48
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#24737

## What this PR does / why we need it:

This PR continues the unfinished work from matrixorigin#24772 while preserving its
original commits and authorship.

The inherited change allowed LEFT/RIGHT/FULL OUTER JOIN without `ON` or
`USING`. Review established that this is not valid MySQL outer-join
syntax and that conditionless JOIN semantics should remain limited to
inner/cross-product forms.

The implementation now:

- keeps `ON` or `USING` mandatory for LEFT, RIGHT, and FULL OUTER JOIN;
- returns the explicit parser error `outer join requires ON/USING
clause` when the condition is missing;
- continues accepting ordinary JOIN, INNER JOIN, CROSS JOIN,
STRAIGHT_JOIN, and NATURAL OUTER JOIN without an explicit condition
where their grammar permits it;
- removes the inherited positive BVT cases that executed conditionless
outer joins;
- covers LEFT/RIGHT/FULL, derived-table, trailing-clause, chained-join,
valid `ON/USING`, and adjacent join semantics.

## Validation

- regenerated `mysql_sql.go` from `mysql_sql.y` with zero parser
conflicts
- verified parser generation is deterministic (`make -B -C
pkg/sql/parsers/dialect/mysql mysql_sql.go` leaves no diff)
- `go test -count=1 -run '^TestOuterJoinRequiresCondition$'
./pkg/sql/parsers/dialect/mysql`
- `go test -race -count=10 -run '^TestOuterJoinRequiresCondition$'
./pkg/sql/parsers/dialect/mysql`
- `go test -count=1 ./pkg/sql/parsers/...`
- `go vet ./pkg/sql/parsers/...`
- `git diff --check`

---------

Co-authored-by: ULookup <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#24737

## What this PR does / why we need it:

This PR continues the unfinished work from matrixorigin#24772 while preserving its
original commits and authorship.

The inherited change allowed LEFT/RIGHT/FULL OUTER JOIN without `ON` or
`USING`. Review established that this is not valid MySQL outer-join
syntax and that conditionless JOIN semantics should remain limited to
inner/cross-product forms.

The implementation now:

- keeps `ON` or `USING` mandatory for LEFT, RIGHT, and FULL OUTER JOIN;
- returns the explicit parser error `outer join requires ON/USING
clause` when the condition is missing;
- continues accepting ordinary JOIN, INNER JOIN, CROSS JOIN,
STRAIGHT_JOIN, and NATURAL OUTER JOIN without an explicit condition
where their grammar permits it;
- removes the inherited positive BVT cases that executed conditionless
outer joins;
- covers LEFT/RIGHT/FULL, derived-table, trailing-clause, chained-join,
valid `ON/USING`, and adjacent join semantics.

## Validation

- regenerated `mysql_sql.go` from `mysql_sql.y` with zero parser
conflicts
- verified parser generation is deterministic (`make -B -C
pkg/sql/parsers/dialect/mysql mysql_sql.go` leaves no diff)
- `go test -count=1 -run '^TestOuterJoinRequiresCondition$'
./pkg/sql/parsers/dialect/mysql`
- `go test -race -count=10 -run '^TestOuterJoinRequiresCondition$'
./pkg/sql/parsers/dialect/mysql`
- `go test -count=1 ./pkg/sql/parsers/...`
- `go vet ./pkg/sql/parsers/...`
- `git diff --check`

---------

Co-authored-by: ULookup <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#24737

## What this PR does / why we need it:

This PR continues the unfinished work from matrixorigin#24772 while preserving its
original commits and authorship.

The inherited change allowed LEFT/RIGHT/FULL OUTER JOIN without `ON` or
`USING`. Review established that this is not valid MySQL outer-join
syntax and that conditionless JOIN semantics should remain limited to
inner/cross-product forms.

The implementation now:

- keeps `ON` or `USING` mandatory for LEFT, RIGHT, and FULL OUTER JOIN;
- returns the explicit parser error `outer join requires ON/USING
clause` when the condition is missing;
- continues accepting ordinary JOIN, INNER JOIN, CROSS JOIN,
STRAIGHT_JOIN, and NATURAL OUTER JOIN without an explicit condition
where their grammar permits it;
- removes the inherited positive BVT cases that executed conditionless
outer joins;
- covers LEFT/RIGHT/FULL, derived-table, trailing-clause, chained-join,
valid `ON/USING`, and adjacent join semantics.

## Validation

- regenerated `mysql_sql.go` from `mysql_sql.y` with zero parser
conflicts
- verified parser generation is deterministic (`make -B -C
pkg/sql/parsers/dialect/mysql mysql_sql.go` leaves no diff)
- `go test -count=1 -run '^TestOuterJoinRequiresCondition$'
./pkg/sql/parsers/dialect/mysql`
- `go test -race -count=10 -run '^TestOuterJoinRequiresCondition$'
./pkg/sql/parsers/dialect/mysql`
- `go test -count=1 ./pkg/sql/parsers/...`
- `go vet ./pkg/sql/parsers/...`
- `git diff --check`

---------

Co-authored-by: ULookup <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants