clockworklabs / clockworklabs/SpacetimeDB

Implemented `OUTER JOIN` support

Open
#4,911 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

This issue tracks reimplementing the work from stale PR #2892, which has been closed because it is too far out of date to merge directly.

## Original pull request
- PR #2892: [Implemented `OUTER JOIN` support](https://github.com/clockworklabs/SpacetimeDB/pull/2892)
- Original author: @egormanga

## What the original PR was trying to do
# Description of Changes

Previously, only INNER and CROSS joins were possible.
This adds support for LEFT OUTER joins with certain limitations (basically, same as for INNER).

Doesn't play so well with RLS currently, though (I assume it's something to do with query optimization for similar joins, or that RLS discards already right-matched rows without substituting them with null-matched instead).

API and ABI breaking changes

Non-present column values come in as () units (for null) instead of the expected type, so it's like everything suddenly became Optional. This might require some additional handling on the clients.

Probably won't work with the PG wire protocol for the same reason, although the fix for that will be server-side, as the protocol itself is fine with nulls.

Expected complexity level and risk

3.

Testing

  • Manual testing

  • Needs unit tests

    Closure context

    • Closed from the close-stale-pr-create-issue stale-PR sweep.

    Reimplementation notes

    • Reimplement this work on top of current master in a new PR.
    • Keep the original PR linked as historical context and as a source of useful implementation ideas where still relevant.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing PR #2892 and the current master implementation of joins. Reimplement LEFT OUTER JOIN support while checking the noted RLS and PostgreSQL wire-protocol limitations, and add the unit tests the original work lacked. Done means the join works on current master with its null-valued unmatched columns and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.