Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions enginetest/queries/join_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,33 @@ var JoinScriptTests = []ScriptTest{
},
},
},
{
// https://github.com/dolthub/dolt/issues/10268
// https://github.com/dolthub/dolt/issues/10295
// TODO: when natural full join has been implemented, move this to join_op_tests
Name: "natural full join",
SetUpScript: []string{
"CREATE TABLE t0(c0 BOOLEAN, c1 INT, PRIMARY KEY(c0));",
"CREATE TABLE t1(c0 BOOLEAN, c1 VARCHAR(500), PRIMARY KEY(c0));",
"INSERT INTO t1(c1, c0) VALUES (NULL, true);",
"INSERT INTO t0(c0, c1) VALUES (true, 4);",
},
Assertions: []ScriptTestAssertion{
{
// https://github.com/dolthub/dolt/issues/10295
Skip: true,
Query: "SELECT * FROM t1 NATURAL FULL JOIN t0;",
Expected: []sql.Row{
{1, 4},
{1, nil},
},
},
{
Query: "SELECT * FROM t1 NATURAL FULL JOIN t0;",
ExpectedErrStr: "unknown using join type: natural full join",
},
},
},
}

var LateralJoinScriptTests = []ScriptTest{
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/dolthub/go-icu-regex v0.0.0-20250916051405-78a38d478790
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
github.com/dolthub/vitess v0.0.0-20251210200925-1d33d416d162
github.com/dolthub/vitess v0.0.0-20260108222406-f8a2587c4954
github.com/go-sql-driver/mysql v1.9.3
github.com/gocraft/dbr/v2 v2.7.2
github.com/google/uuid v1.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71 h1:bMGS25NWAGTE
github.com/dolthub/jsonpath v0.0.2-0.20240227200619-19675ab05c71/go.mod h1:2/2zjLQ/JOOSbbSboojeg+cAwcRV0fDLzIiWch/lhqI=
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9XGFa6q5Ap4Z/OhNkAMBaK5YeuEzwJt+NZdhiE=
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY=
github.com/dolthub/vitess v0.0.0-20251210200925-1d33d416d162 h1:6RW2VpUs/cUFdvk4mXSmJfQZLs9wJABVjke3CHGJBcs=
github.com/dolthub/vitess v0.0.0-20251210200925-1d33d416d162/go.mod h1:FLWqdXsAeeBQyFwDjmBVu0GnbjI2MKeRf3tRVdJEKlI=
github.com/dolthub/vitess v0.0.0-20260108222406-f8a2587c4954 h1:VN2ZjnYPyxcAN/XetvcdumFbI2Ad/Gb47Qwdo9REY3A=
github.com/dolthub/vitess v0.0.0-20260108222406-f8a2587c4954/go.mod h1:FLWqdXsAeeBQyFwDjmBVu0GnbjI2MKeRf3tRVdJEKlI=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
Expand Down
4 changes: 3 additions & 1 deletion sql/planbuilder/from.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func (b *Builder) isUsingJoin(te *ast.JoinTableExpr) bool {
return te.Condition.Using != nil ||
strings.EqualFold(te.Join, ast.NaturalJoinStr) ||
strings.EqualFold(te.Join, ast.NaturalLeftJoinStr) ||
strings.EqualFold(te.Join, ast.NaturalRightJoinStr)
strings.EqualFold(te.Join, ast.NaturalRightJoinStr) ||
strings.EqualFold(te.Join, ast.NaturalFullJoinStr)
}

func (b *Builder) canConvertToCrossJoin(te *ast.JoinTableExpr) bool {
Expand Down Expand Up @@ -264,6 +265,7 @@ func (b *Builder) buildUsingJoin(inScope, leftScope, rightScope *scope, te *ast.
}

switch strings.ToLower(te.Join) {
// TODO handle ast.FullOuterJoinStr, ast.NaturalFullJoinStr case https://github.com/dolthub/dolt/issues/10295
case ast.JoinStr, ast.NaturalJoinStr:
outScope.node = plan.NewInnerJoin(leftScope.node, rightScope.node, filter)
case ast.LeftJoinStr, ast.NaturalLeftJoinStr:
Expand Down
Loading