Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moving prepared history table test out of broken #4179

Merged
merged 21 commits into from
Aug 31, 2022
Merged
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ require (
)

require (
github.com/dolthub/go-mysql-server v0.12.1-0.20220830220815-1e1f50eaae23
github.com/dolthub/go-mysql-server v0.12.1-0.20220831170105-c244c617c289
github.com/google/flatbuffers v2.0.6+incompatible
github.com/gosuri/uilive v0.0.4
github.com/kch42/buzhash v0.0.0-20160816060738-9bdec3dec7c6
Expand Down
4 changes: 2 additions & 2 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ github.com/dolthub/flatbuffers v1.13.0-dh.1 h1:OWJdaPep22N52O/0xsUevxJ6Qfw1M2txC
github.com/dolthub/flatbuffers v1.13.0-dh.1/go.mod h1:CorYGaDmXjHz1Z7i50PYXG1Ricn31GcA2wNOTFIQAKE=
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
github.com/dolthub/go-mysql-server v0.12.1-0.20220830220815-1e1f50eaae23 h1:whaYiETfwIMm1LBOsZrMlbnD5H+LPjsbGqCA/CxoNZs=
github.com/dolthub/go-mysql-server v0.12.1-0.20220830220815-1e1f50eaae23/go.mod h1:F/UtM55EgpqIiWoXwPg0jx8euPYwUpJsKHLiFtEjKwM=
github.com/dolthub/go-mysql-server v0.12.1-0.20220831170105-c244c617c289 h1:0JzYXS9f/380dvYGV1NbdJfFO8wi+otAMiR6Ae06iIM=
github.com/dolthub/go-mysql-server v0.12.1-0.20220831170105-c244c617c289/go.mod h1:F/UtM55EgpqIiWoXwPg0jx8euPYwUpJsKHLiFtEjKwM=
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371 h1:oyPHJlzumKta1vnOQqUnfdz+pk3EmnHS3Nd0cCT0I2g=
github.com/dolthub/ishell v0.0.0-20220112232610-14e753f0f371/go.mod h1:dhGBqcCEfK5kuFmeO5+WOx3hqc1k3M29c1oS/R7N4ms=
github.com/dolthub/jsonpath v0.0.0-20210609232853-d49537a30474 h1:xTrR+l5l+1Lfq0NvhiEsctylXinUMFhhsqaEcl414p8=
Expand Down
198 changes: 46 additions & 152 deletions go/libraries/doltcore/sqle/enginetest/dolt_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,29 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{
{3, 4},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where pk = 3",
Expected: []sql.Row{
{"Exchange"},
{" └─ Filter(dolt_history_t1.pk = 3)"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.pk]"},
{" ├─ filters: [{[3, 3]}]"},
{" └─ columns: [pk c]"},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where pk = 3 and committer = 'someguy'",
Expected: []sql.Row{
{"Exchange"},
{" └─ Project(dolt_history_t1.pk, dolt_history_t1.c)"},
{" └─ Filter((dolt_history_t1.pk = 3) AND (dolt_history_t1.committer = 'someguy'))"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.pk]"},
{" ├─ filters: [{[3, 3]}]"},
{" └─ columns: [pk c committer]"},
},
},
},
},
{
Expand Down Expand Up @@ -1050,6 +1073,29 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{
{9, 10},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where c = 4",
Expected: []sql.Row{
{"Exchange"},
{" └─ Filter(dolt_history_t1.c = 4)"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.c]"},
{" ├─ filters: [{[4, 4]}]"},
{" └─ columns: [pk c]"},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where c = 10 and committer = 'someguy'",
Expected: []sql.Row{
{"Exchange"},
{" └─ Project(dolt_history_t1.pk, dolt_history_t1.c)"},
{" └─ Filter((dolt_history_t1.c = 10) AND (dolt_history_t1.committer = 'someguy'))"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.c]"},
{" ├─ filters: [{[10, 10]}]"},
{" └─ columns: [pk c committer]"},
},
},
},
},
{
Expand Down Expand Up @@ -1206,83 +1252,6 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{
},
},
},
{
SkipPrepared: true,
Name: "index by primary key",
SetUpScript: []string{
"create table t1 (pk int primary key, c int);",
"call dolt_add('.')",
"insert into t1 values (1,2), (3,4)",
"set @Commit1 = dolt_commit('-am', 'initial table');",
"insert into t1 values (5,6), (7,8)",
"set @Commit2 = dolt_commit('-am', 'two more rows');",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "explain select pk, c from dolt_history_t1 where pk = 3",
Expected: []sql.Row{
{"Exchange"},
{" └─ Filter(dolt_history_t1.pk = 3)"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.pk]"},
{" ├─ filters: [{[3, 3]}]"},
{" └─ columns: [pk c]"},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where pk = 3 and committer = 'someguy'",
Expected: []sql.Row{
{"Exchange"},
{" └─ Project(dolt_history_t1.pk, dolt_history_t1.c)"},
{" └─ Filter((dolt_history_t1.pk = 3) AND (dolt_history_t1.committer = 'someguy'))"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.pk]"},
{" ├─ filters: [{[3, 3]}]"},
{" └─ columns: [pk c committer]"},
},
},
},
},
{
SkipPrepared: true,
Name: "adding an index",
SetUpScript: []string{
"create table t1 (pk int primary key, c int);",
"call dolt_add('.')",
"insert into t1 values (1,2), (3,4)",
"set @Commit1 = dolt_commit('-am', 'initial table');",
"insert into t1 values (5,6), (7,8)",
"set @Commit2 = dolt_commit('-am', 'two more rows');",
"insert into t1 values (9,10), (11,12)",
"create index t1_c on t1(c)",
"set @Commit2 = dolt_commit('-am', 'two more rows and an index');",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "explain select pk, c from dolt_history_t1 where c = 4",
Expected: []sql.Row{
{"Exchange"},
{" └─ Filter(dolt_history_t1.c = 4)"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.c]"},
{" ├─ filters: [{[4, 4]}]"},
{" └─ columns: [pk c]"},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where c = 10 and committer = 'someguy'",
Expected: []sql.Row{
{"Exchange"},
{" └─ Project(dolt_history_t1.pk, dolt_history_t1.c)"},
{" └─ Filter((dolt_history_t1.c = 10) AND (dolt_history_t1.committer = 'someguy'))"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.c]"},
{" ├─ filters: [{[10, 10]}]"},
{" └─ columns: [pk c committer]"},
},
},
},
},
{
SkipPrepared: true,
Name: "dolt_history table with AS OF",
Expand Down Expand Up @@ -1312,81 +1281,6 @@ var HistorySystemTableScriptTests = []queries.ScriptTest{
// BrokenHistorySystemTableScriptTests contains tests that work for non-prepared, but don't work
// for prepared queries.
var BrokenHistorySystemTableScriptTests = []queries.ScriptTest{
{
Name: "index by primary key",
SetUpScript: []string{
"create table t1 (pk int primary key, c int);",
"call dolt_add('.')",
"insert into t1 values (1,2), (3,4)",
"set @Commit1 = dolt_commit('-am', 'initial table');",
"insert into t1 values (5,6), (7,8)",
"set @Commit2 = dolt_commit('-am', 'two more rows');",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "explain select pk, c from dolt_history_t1 where pk = 3",
Expected: []sql.Row{
{"Exchange"},
{" └─ Filter(dolt_history_t1.pk = 3)"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.pk]"},
{" ├─ filters: [{[3, 3]}]"},
{" └─ columns: [pk c]"},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where pk = 3 and committer = 'someguy'",
Expected: []sql.Row{
{"Exchange"},
{" └─ Project(dolt_history_t1.pk, dolt_history_t1.c)"},
{" └─ Filter((dolt_history_t1.pk = 3) AND (dolt_history_t1.committer = 'someguy'))"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.pk]"},
{" ├─ filters: [{[3, 3]}]"},
{" └─ columns: [pk c committer]"},
},
},
},
},
{
Name: "adding an index",
SetUpScript: []string{
"create table t1 (pk int primary key, c int);",
"call dolt_add('.')",
"insert into t1 values (1,2), (3,4)",
"set @Commit1 = dolt_commit('-am', 'initial table');",
"insert into t1 values (5,6), (7,8)",
"set @Commit2 = dolt_commit('-am', 'two more rows');",
"insert into t1 values (9,10), (11,12)",
"create index t1_c on t1(c)",
"set @Commit2 = dolt_commit('-am', 'two more rows and an index');",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "explain select pk, c from dolt_history_t1 where c = 4",
Expected: []sql.Row{
{"Exchange"},
{" └─ Filter(dolt_history_t1.c = 4)"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.c]"},
{" ├─ filters: [{[4, 4]}]"},
{" └─ columns: [pk c]"},
},
},
{
Query: "explain select pk, c from dolt_history_t1 where c = 10 and committer = 'someguy'",
Expected: []sql.Row{
{"Exchange"},
{" └─ Project(dolt_history_t1.pk, dolt_history_t1.c)"},
{" └─ Filter((dolt_history_t1.c = 10) AND (dolt_history_t1.committer = 'someguy'))"},
{" └─ IndexedTableAccess(dolt_history_t1)"},
{" ├─ index: [dolt_history_t1.c]"},
{" ├─ filters: [{[10, 10]}]"},
{" └─ columns: [pk c committer]"},
},
},
},
},
{
Name: "dolt_history table with AS OF",
SetUpScript: []string{
Expand Down