Skip to content

Conversation

@aunjgr
Copy link
Contributor

@aunjgr aunjgr commented Dec 22, 2025

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #23318

What this PR does / why we need it:

This PR merges INNER/LEFT/RIGHT/SINGLE join operators into one HashJoin. Advantages:

  • less code and more readability
  • apply the 8192-row slicing mechanism to all types of joins, which was only implemented for inner/left join
  • fixed some minor bad designs

Copy link
Contributor

@fengttt fengttt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not right -- how come this will have more added code that removed?

Did you forget to remove 2 join operators? Or it is still intermediate step and you will remove later?

@aunjgr
Copy link
Contributor Author

aunjgr commented Dec 23, 2025

This is not right -- how come this will have more added code that removed?

Did you forget to remove 2 join operators? Or it is still intermediate step and you will remove later?

It's still WIP. Some old code have not been deleted.

@aunjgr
Copy link
Contributor Author

aunjgr commented Jan 5, 2026

  • High: plan.Node_SINGLE now drops all probe rows when the build side is empty. In HashJoin.Call the empty-map guard skips processing whenever the join type is not LEFT, so SINGLE never calls emptyProbe to emit NULLs for the scalar subquery case; previously the single operator returned one row with NULL right columns per probe row when the subquery was empty. This changes scalar subquery semantics from “NULL” to “no row”. Suggested fix: treat Node_SINGLE like Node_LEFT in the empty-map branch so emptyProbe runs for scalar joins with an empty build side.
// join.goLines 144-150
if bat.IsEmpty() {          continue        }        if ctr.mp == nil && hash
* Testing gap: pkg/sql/colexec/single/join_test.go (and the operator itself) was removed, but there’s no new coverage for scalar/“single” join behavior in hashjoin (empty subquery -> NULL row, multi-row -> error). Recommend adding tests around the new hashjoin-based SINGLE path to prevent regressions.

Fixed and added bvt cases

@aunjgr aunjgr requested a review from XuPeng-SH January 5, 2026 14:04
@mergify mergify bot added the queued label Jan 5, 2026
@mergify mergify bot merged commit 8311a61 into matrixorigin:main Jan 5, 2026
23 of 24 checks passed
@mergify
Copy link
Contributor

mergify bot commented Jan 5, 2026

Merge Queue Status

✅ The pull request has been merged at 6cd026e

This pull request spent 6 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • branch-protection-review-decision = APPROVED [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Ubuntu/x86
    • check-neutral = Matrixone CI / SCA Test on Ubuntu/x86
    • check-skipped = Matrixone CI / SCA Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(Optimistic/PUSH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH,Optimistic)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-neutral = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
    • check-skipped = Matrixone Upgrade CI / Compatibility Test With Target on Linux/x64(LAUNCH)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone Utils CI / Coverage
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage

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

Labels

kind/refactor Code refactor size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants