Two-table joins and qualified-name binding
Implement the following agreed behavior through the shared engine interfaces.
Contract
| Field | Value |
|---|---|
| Specification | QUERY-004 |
| Module | sql |
| Scope | Required implementation or delivery |
| Milestone | M2, due 2026-12-20 |
| Owner role | SQL / frontend — teammate to claim |
| Implementation | Planned; scaffold only |
| Contract review | Team review required before implementation |
Interface
NestedLoopJoin / IndexNestedLoopJoin.next()
These are proposed C++ design contracts, not an already implemented API. Shared types and ownership define the intended module boundaries.
Dependencies
Acceptance checklist
- Bind qualified columns from two FROM tables
- Evaluate join and local predicates, preserve duplicate multiplicity
- Pass small and imported dataset joins without materializing the Cartesian product
Setup data
Run this in a fresh isolated data directory before the example. Setup commands emit their own results; the expected block below covers only the listed input.
CREATE DATABASE demo;
USE demo;
CREATE TABLE people (id INT NOT NULL, name VARCHAR(16) NOT NULL, score FLOAT NOT NULL);
INSERT INTO people VALUES (1, 'Ada', 90.5), (2, 'Lin', 80.0);
CREATE TABLE labels (pid INT NOT NULL, label VARCHAR(8) NOT NULL);
INSERT INTO labels VALUES (1, 'A'), (1, 'B');
Input
SELECT people.name, labels.label FROM people, labels WHERE people.id = labels.pid;
Expected output
people.name,labels.label
Ada,A
Ada,B
@
Where no ORDER BY appears, row order is not guaranteed. Error message text is illustrative; required diagnostic keywords and result framing are binding.
Rejections and state
- Ambiguous/unknown reference -> !ERROR
Verification
Completion rule
Link this spec and its GitLab issue in an MR into develop. Include relevant Linux evidence, obtain the other teammate’s review, merge, delete the feature branch, and close the issue. A page describes intended behavior; the GitLab issue and merged code determine completion.