From a4742cb55eb0366058cf6ec83d2670bcbcfd9cb9 Mon Sep 17 00:00:00 2001 From: Taylor Bantle Date: Thu, 14 Nov 2024 11:45:04 -0800 Subject: [PATCH 1/7] Add dolt_schema and dolt_procedure tests --- testing/go/dolt_tables_test.go | 210 +++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) diff --git a/testing/go/dolt_tables_test.go b/testing/go/dolt_tables_test.go index b1533be026..8c201f1707 100755 --- a/testing/go/dolt_tables_test.go +++ b/testing/go/dolt_tables_test.go @@ -1576,6 +1576,76 @@ func TestUserSpaceDoltTables(t *testing.T) { Query: `SELECT * FROM DOCS`, Expected: []sql.Row{{1}}, }, + { + Query: "SET search_path = 'public'", + Expected: []sql.Row{}, + }, + { + Query: `DELETE FROM dolt.docs WHERE doc_name = 'README.md'`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT * FROM dolt.docs`, + Expected: []sql.Row{}, + }, + { + Query: `DELETE FROM dolt_docs WHERE doc_name = 'README.md'`, + Expected: []sql.Row{}, + }, + // TODO: Test dolt.docs in diffs + }, + }, + { + Name: "dolt procedures", + SetUpScript: []string{ + // TODO: Create procedure when supported + }, + Assertions: []ScriptTestAssertion{ + { + Query: `SELECT * FROM dolt_procedures`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT * FROM public.dolt_procedures`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT dolt_procedures.name FROM public.dolt_procedures`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT name FROM other.dolt_procedures`, + ExpectedErr: "database schema not found", + }, + // TODO: Add diff tests when create procedure works + { + Query: `CREATE SCHEMA newschema`, + Expected: []sql.Row{}, + }, + { + Query: "SET search_path = 'newschema'", + Expected: []sql.Row{}, + }, + { + Query: `SELECT * FROM newschema.dolt_procedures`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT name FROM dolt_procedures`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT name FROM public.dolt_procedures`, + Expected: []sql.Row{}, + }, + { + Query: "SET search_path = 'newschema,public'", + Expected: []sql.Row{}, + }, + { + Query: `SELECT name FROM dolt_procedures`, + Expected: []sql.Row{}, + }, }, }, { @@ -1831,6 +1901,7 @@ func TestUserSpaceDoltTables(t *testing.T) { Name: "dolt schemas", SetUpScript: []string{ "create view myView as select 2 + 2", + // TODO: Add more tests when triggers and events work in doltgres }, Assertions: []ScriptTestAssertion{ { @@ -1845,6 +1916,145 @@ func TestUserSpaceDoltTables(t *testing.T) { }, }, }, + { + Query: `SELECT * FROM public.dolt_schemas`, + Expected: []sql.Row{ + { + "view", + "myview", + "create view myView as select 2 + 2", + "{\"CreatedAt\":0}", + "NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES", + }, + }, + }, + { + Query: `SELECT dolt_schemas.name FROM public.dolt_schemas`, + Expected: []sql.Row{{"myview"}}, + }, + { + Query: `SELECT name FROM other.dolt_schemas`, + ExpectedErr: "database schema not found", + }, + { + Query: `SELECT * FROM dolt_diff_summary('main', 'WORKING')`, + Expected: []sql.Row{ + {"", "public.dolt_schemas", "added", 1, 1}, + }, + }, + { + Query: `SELECT * FROM dolt_diff_summary('main', 'WORKING', 'dolt_schemas')`, + Expected: []sql.Row{ + {"", "public.dolt_schemas", "added", 1, 1}, + }, + }, + { + Query: `SELECT * FROM dolt_diff_summary('main', 'WORKING', 'dolt_schemas')`, + Expected: []sql.Row{ + {"", "public.dolt_schemas", "added", 1, 1}, + }, + }, + { + Query: `SELECT diff_type, from_name, to_name FROM dolt_diff('main', 'WORKING', 'dolt_schemas')`, + Expected: []sql.Row{ + {"added", nil, "myview"}, + }, + }, + { + Query: `SELECT diff_type, from_name, to_name FROM dolt_diff('main', 'WORKING', 'dolt_schemas')`, + Expected: []sql.Row{ + {"added", nil, "myview"}, + }, + }, + { + Query: `CREATE SCHEMA newschema`, + Expected: []sql.Row{}, + }, + { + Query: "SET search_path = 'newschema'", + Expected: []sql.Row{}, + }, + { + Query: `CREATE VIEW testView AS SELECT 1 + 1`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT * FROM newschema.dolt_schemas`, + Expected: []sql.Row{ + { + "view", + "testview", + "CREATE VIEW testView AS SELECT 1 + 1", + "{\"CreatedAt\":0}", + "NO_ENGINE_SUBSTITUTION,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES", + }, + }, + }, + { + Query: `SELECT name FROM dolt_schemas`, + Expected: []sql.Row{{"testview"}}, + }, + { + Query: "SELECT table_schema, table_name FROM information_schema.views", + Expected: []sql.Row{ + {"newschema", "testview"}, + {"public", "myview"}, + }, + }, + { + Query: `SELECT * FROM dolt_diff_summary('main', 'WORKING', 'dolt_schemas')`, + Expected: []sql.Row{ + {"", "newschema.dolt_schemas", "added", 1, 1}, + }, + }, + { + Skip: true, // TODO: Should be able to specify schema + Query: `SELECT * FROM dolt_diff_summary('main', 'WORKING', 'public.dolt_schemas')`, + Expected: []sql.Row{ + {"", "public.dolt_schemas", "added", 1, 1}, + }, + }, + { + Query: `SELECT name FROM public.dolt_schemas`, + Expected: []sql.Row{{"myview"}}, + }, + { + Query: "DROP VIEW myView", + ExpectedErr: "the view postgres.myview does not exist", + }, + { + Skip: true, // TODO: Should work + Query: "DROP VIEW public.myView", + Expected: []sql.Row{}, + }, + { + Skip: true, // TODO: Adds to current schema instead of public schema + Query: "create view public.myNewView as select 3 + 3", + Expected: []sql.Row{}, + }, + { + Skip: true, + Query: `SELECT name FROM public.dolt_schemas`, + Expected: []sql.Row{{"myview", "mynewview"}}, + }, + { + Query: `SELECT name FROM dolt_schemas`, + Expected: []sql.Row{{"testview"}}, + }, + { + Query: "SET search_path = 'newschema,public'", + Expected: []sql.Row{}, + }, + { + Query: `SELECT name FROM dolt_schemas`, + Expected: []sql.Row{{"testview"}}, + }, + { + Query: `SELECT * FROM dolt_diff_summary('main', 'WORKING', 'dolt_schemas')`, + Expected: []sql.Row{ + {"", "newschema.dolt_schemas", "added", 1, 1}, + }, + }, }, }, { From 48a53dac16687fbf8f35b4f811d78ace91d03fc2 Mon Sep 17 00:00:00 2001 From: Taylor Bantle Date: Thu, 14 Nov 2024 15:26:25 -0800 Subject: [PATCH 2/7] More tests --- testing/go/dolt_tables_test.go | 60 +++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/testing/go/dolt_tables_test.go b/testing/go/dolt_tables_test.go index 8c201f1707..936e11eb57 100755 --- a/testing/go/dolt_tables_test.go +++ b/testing/go/dolt_tables_test.go @@ -1932,6 +1932,10 @@ func TestUserSpaceDoltTables(t *testing.T) { Query: `SELECT dolt_schemas.name FROM public.dolt_schemas`, Expected: []sql.Row{{"myview"}}, }, + { + Query: `SELECT * FROM public.myview`, + Expected: []sql.Row{{4}}, + }, { Query: `SELECT name FROM other.dolt_schemas`, ExpectedErr: "database schema not found", @@ -1974,6 +1978,14 @@ func TestUserSpaceDoltTables(t *testing.T) { Query: "SET search_path = 'newschema'", Expected: []sql.Row{}, }, + { + Query: `SELECT * FROM myview`, + ExpectedErr: "table not found: myview", + }, + { + Query: `SELECT * FROM public.myview`, + Expected: []sql.Row{{4}}, + }, { Query: `CREATE VIEW testView AS SELECT 1 + 1`, Expected: []sql.Row{}, @@ -2023,19 +2035,20 @@ func TestUserSpaceDoltTables(t *testing.T) { ExpectedErr: "the view postgres.myview does not exist", }, { - Skip: true, // TODO: Should work Query: "DROP VIEW public.myView", Expected: []sql.Row{}, }, { - Skip: true, // TODO: Adds to current schema instead of public schema + Query: `SELECT name FROM public.dolt_schemas`, + Expected: []sql.Row{}, + }, + { Query: "create view public.myNewView as select 3 + 3", Expected: []sql.Row{}, }, { - Skip: true, Query: `SELECT name FROM public.dolt_schemas`, - Expected: []sql.Row{{"myview", "mynewview"}}, + Expected: []sql.Row{{"mynewview"}}, }, { Query: `SELECT name FROM dolt_schemas`, @@ -2055,6 +2068,45 @@ func TestUserSpaceDoltTables(t *testing.T) { {"", "newschema.dolt_schemas", "added", 1, 1}, }, }, + // Test same view name on different schemas + { + Query: "SET search_path = 'public'", + Expected: []sql.Row{}, + }, + { + Query: `CREATE VIEW testView AS SELECT 4 + 4`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT name, fragment FROM dolt_schemas`, + Expected: []sql.Row{ + {"mynewview", "create view public.myNewView as select 3 + 3"}, + {"testview", "CREATE VIEW testView AS SELECT 4 + 4"}, + }, + }, + { + Query: `SELECT name, fragment FROM newschema.dolt_schemas`, + Expected: []sql.Row{{"testview", "CREATE VIEW testView AS SELECT 1 + 1"}}, + }, + { + Query: `SELECT name, fragment FROM dolt_schemas`, + Expected: []sql.Row{ + {"mynewview", "create view public.myNewView as select 3 + 3"}, + {"testview", "CREATE VIEW testView AS SELECT 4 + 4"}, + }, + }, + { + Query: "DROP VIEW newschema.testView", + Expected: []sql.Row{}, + }, + { + Query: `SELECT name FROM newschema.dolt_schemas`, + Expected: []sql.Row{}, + }, + { + Query: `SELECT name FROM dolt_schemas`, + Expected: []sql.Row{{"mynewview"}, {"testview"}}, + }, }, }, { From ff5ba9e0395ea322229239be18095e41a9f14776 Mon Sep 17 00:00:00 2001 From: tbantle22 Date: Fri, 15 Nov 2024 00:41:24 +0000 Subject: [PATCH 3/7] [ga-bump-dep] Bump dependency in Doltgres by tbantle22 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 66ec3bb024..711eb5df5e 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,11 @@ require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/cockroachdb/apd/v2 v2.0.3-0.20200518165714-d020e156310a github.com/cockroachdb/errors v1.7.5 - github.com/dolthub/dolt/go v0.40.5-0.20241114235619-0995efed23b9 + github.com/dolthub/dolt/go v0.40.5-0.20241115003943-1e30a48baa8b github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662 - github.com/dolthub/go-mysql-server v0.18.2-0.20241114232015-87d29acb3d67 + github.com/dolthub/go-mysql-server v0.18.2-0.20241114235754-8a3476a7e303 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 github.com/dolthub/vitess v0.0.0-20241111235433-a20a5ab9d7c9 github.com/fatih/color v1.13.0 diff --git a/go.sum b/go.sum index f35d3fe881..438a73cb85 100644 --- a/go.sum +++ b/go.sum @@ -214,8 +214,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dolthub/dolt/go v0.40.5-0.20241114235619-0995efed23b9 h1:9B26h5cfQMDZvEw2ZrQN1+MYqPZMNXJzgdSXdT+VgzM= -github.com/dolthub/dolt/go v0.40.5-0.20241114235619-0995efed23b9/go.mod h1:AJRhYyewJAejq+sd74zLcL3piCOBkkUwwp4iR6E+aPs= +github.com/dolthub/dolt/go v0.40.5-0.20241115003943-1e30a48baa8b h1:XdURZRgkSJ+D0Cfgzc9gE1+/T/ZZhUqCpIZ3qNWh57M= +github.com/dolthub/dolt/go v0.40.5-0.20241115003943-1e30a48baa8b/go.mod h1:NGZ8GtQiH1t9W7VFRQxrVDigrWWaZaaTVjjn3hDBsSQ= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df h1:xafyaNR+hSk5TwOhmNkhhrmOZKIOkxAOCiIEUzlIybc= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df/go.mod h1:L5RDYZbC9BBWmoU2+TjTekeqqhFXX5EqH9ln00O0stY= github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww= @@ -224,8 +224,8 @@ 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-icu-regex v0.0.0-20240916130659-0118adc6b662 h1:aC17hZD6iwzBwwfO5M+3oBT5E5gGRiQPdn+vzpDXqIA= github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= -github.com/dolthub/go-mysql-server v0.18.2-0.20241114232015-87d29acb3d67 h1:bl9C66VxMQVd3cyS6Owy4IE9XeSvFbm2/PaJreWI1eA= -github.com/dolthub/go-mysql-server v0.18.2-0.20241114232015-87d29acb3d67/go.mod h1:sOMQzWUvHvJECzpcUxjDgV5BR/A7U+hOh596PUO2NPI= +github.com/dolthub/go-mysql-server v0.18.2-0.20241114235754-8a3476a7e303 h1:SewEB6sbC49Co2pX5wRXkLSveGtfy60A2s/kZaMShrc= +github.com/dolthub/go-mysql-server v0.18.2-0.20241114235754-8a3476a7e303/go.mod h1:sOMQzWUvHvJECzpcUxjDgV5BR/A7U+hOh596PUO2NPI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q= github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE= From 2998b029901867b54070b57260e2b206fe2163c1 Mon Sep 17 00:00:00 2001 From: Taylor Bantle Date: Fri, 15 Nov 2024 10:58:50 -0800 Subject: [PATCH 4/7] Add drop view if exists test --- testing/go/dolt_tables_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testing/go/dolt_tables_test.go b/testing/go/dolt_tables_test.go index 936e11eb57..b7de7da181 100755 --- a/testing/go/dolt_tables_test.go +++ b/testing/go/dolt_tables_test.go @@ -2096,7 +2096,11 @@ func TestUserSpaceDoltTables(t *testing.T) { }, }, { - Query: "DROP VIEW newschema.testView", + Query: "DROP VIEW IF EXISTS noexist.testView", + Expected: []sql.Row{}, + }, + { + Query: "DROP VIEW IF EXISTS newschema.testView", Expected: []sql.Row{}, }, { From 2ad3c4a47d32fe81feb63c7b0f91b26d1342354a Mon Sep 17 00:00:00 2001 From: tbantle22 Date: Fri, 15 Nov 2024 20:13:09 +0000 Subject: [PATCH 5/7] [ga-bump-dep] Bump dependency in Doltgres by tbantle22 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 711eb5df5e..db3bae0b0a 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,11 @@ require ( github.com/PuerkitoBio/goquery v1.8.1 github.com/cockroachdb/apd/v2 v2.0.3-0.20200518165714-d020e156310a github.com/cockroachdb/errors v1.7.5 - github.com/dolthub/dolt/go v0.40.5-0.20241115003943-1e30a48baa8b + github.com/dolthub/dolt/go v0.40.5-0.20241115201116-e5d3dcc32851 github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662 - github.com/dolthub/go-mysql-server v0.18.2-0.20241114235754-8a3476a7e303 + github.com/dolthub/go-mysql-server v0.18.2-0.20241115193357-2d21230229d1 github.com/dolthub/sqllogictest/go v0.0.0-20240618184124-ca47f9354216 github.com/dolthub/vitess v0.0.0-20241111235433-a20a5ab9d7c9 github.com/fatih/color v1.13.0 diff --git a/go.sum b/go.sum index 438a73cb85..489a3ad96d 100644 --- a/go.sum +++ b/go.sum @@ -214,8 +214,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dolthub/dolt/go v0.40.5-0.20241115003943-1e30a48baa8b h1:XdURZRgkSJ+D0Cfgzc9gE1+/T/ZZhUqCpIZ3qNWh57M= -github.com/dolthub/dolt/go v0.40.5-0.20241115003943-1e30a48baa8b/go.mod h1:NGZ8GtQiH1t9W7VFRQxrVDigrWWaZaaTVjjn3hDBsSQ= +github.com/dolthub/dolt/go v0.40.5-0.20241115201116-e5d3dcc32851 h1:YXtt75Ea8vubxjZaaFapZOvTk/QAInRpBf6k7zdZKhQ= +github.com/dolthub/dolt/go v0.40.5-0.20241115201116-e5d3dcc32851/go.mod h1:i3nULz7I2VgZuWdGgSJo+SsCJdz1ftjjSOPMAuV0uNk= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df h1:xafyaNR+hSk5TwOhmNkhhrmOZKIOkxAOCiIEUzlIybc= github.com/dolthub/dolt/go/gen/proto/dolt/services/eventsapi v0.0.0-20241104143128-c2bb78c109df/go.mod h1:L5RDYZbC9BBWmoU2+TjTekeqqhFXX5EqH9ln00O0stY= github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww= @@ -224,8 +224,8 @@ 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-icu-regex v0.0.0-20240916130659-0118adc6b662 h1:aC17hZD6iwzBwwfO5M+3oBT5E5gGRiQPdn+vzpDXqIA= github.com/dolthub/go-icu-regex v0.0.0-20240916130659-0118adc6b662/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168= -github.com/dolthub/go-mysql-server v0.18.2-0.20241114235754-8a3476a7e303 h1:SewEB6sbC49Co2pX5wRXkLSveGtfy60A2s/kZaMShrc= -github.com/dolthub/go-mysql-server v0.18.2-0.20241114235754-8a3476a7e303/go.mod h1:sOMQzWUvHvJECzpcUxjDgV5BR/A7U+hOh596PUO2NPI= +github.com/dolthub/go-mysql-server v0.18.2-0.20241115193357-2d21230229d1 h1:FfUUxob0uurW8D8z25GfgEmBwL+dl1zWWkf85iCsnUI= +github.com/dolthub/go-mysql-server v0.18.2-0.20241115193357-2d21230229d1/go.mod h1:sOMQzWUvHvJECzpcUxjDgV5BR/A7U+hOh596PUO2NPI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63 h1:OAsXLAPL4du6tfbBgK0xXHZkOlos63RdKYS3Sgw/dfI= github.com/dolthub/gozstd v0.0.0-20240423170813-23a2903bca63/go.mod h1:lV7lUeuDhH5thVGDCKXbatwKy2KW80L4rMT46n+Y2/Q= github.com/dolthub/ishell v0.0.0-20240701202509-2b217167d718 h1:lT7hE5k+0nkBdj/1UOSFwjWpNxf+LCApbRHgnCA17XE= From 2a3638da577bb333d6af5f563a472ab52da31e5e Mon Sep 17 00:00:00 2001 From: jennifersp Date: Mon, 18 Nov 2024 09:42:27 -0800 Subject: [PATCH 6/7] update Regression test to display 50 tests each at most --- testing/go/regression/tool/main.go | 66 ++++++++++++++++++------------ 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/testing/go/regression/tool/main.go b/testing/go/regression/tool/main.go index 6d1b855832..cde3f6e086 100644 --- a/testing/go/regression/tool/main.go +++ b/testing/go/regression/tool/main.go @@ -92,6 +92,7 @@ func main() { if len(trackersFrom) == len(trackersTo) { // Handle regressions (which we'll display first) foundAnyFailDiff := false + countRegression := 0 for trackerIdx := range trackersFrom { // They're sorted, so this should always hold true. // This will really only fail if the tests were updated. @@ -105,30 +106,37 @@ func main() { } for _, trackerToItem := range trackersTo[trackerIdx].FailPartialItems { if _, ok := fromFailItems[trackerToItem.Query]; !ok { - if !foundAnyFailDiff { - foundAnyFailDiff = true - sb.WriteString("\n## ${\\color{red}Regressions}$\n") + if countRegression <= 50 { + if !foundAnyFailDiff { + foundAnyFailDiff = true + sb.WriteString("\n## ${\\color{red}Regressions}$\n") + } + if !foundFileDiff { + foundFileDiff = true + sb.WriteString(fmt.Sprintf("### %s\n", trackersFrom[trackerIdx].File)) + } + sb.WriteString(fmt.Sprintf("```\nQUERY: %s\n", trackerToItem.Query)) + if len(trackerToItem.ExpectedError) != 0 { + sb.WriteString(fmt.Sprintf("EXPECTED ERROR: %s\n", trackerToItem.ExpectedError)) + } + if len(trackerToItem.UnexpectedError) != 0 { + sb.WriteString(fmt.Sprintf("RECEIVED ERROR: %s\n", trackerToItem.UnexpectedError)) + } + for _, partial := range trackerToItem.PartialSuccess { + sb.WriteString(fmt.Sprintf("PARTIAL: %s\n", partial)) + } + sb.WriteString("```\n") } - if !foundFileDiff { - foundFileDiff = true - sb.WriteString(fmt.Sprintf("### %s\n", trackersFrom[trackerIdx].File)) - } - sb.WriteString(fmt.Sprintf("```\nQUERY: %s\n", trackerToItem.Query)) - if len(trackerToItem.ExpectedError) != 0 { - sb.WriteString(fmt.Sprintf("EXPECTED ERROR: %s\n", trackerToItem.ExpectedError)) - } - if len(trackerToItem.UnexpectedError) != 0 { - sb.WriteString(fmt.Sprintf("RECEIVED ERROR: %s\n", trackerToItem.UnexpectedError)) - } - for _, partial := range trackerToItem.PartialSuccess { - sb.WriteString(fmt.Sprintf("PARTIAL: %s\n", partial)) - } - sb.WriteString("```\n") + countRegression += 1 } } } + if countRegression > 0 { + sb.WriteString(fmt.Sprintf("\n## ${\\color{red}Total Regressions: %v}$\n", countRegression)) + } // Handle progressions (which we'll display second) foundAnySuccessDiff := false + countProgression := 0 for trackerIdx := range trackersFrom { // They're sorted, so this should always hold true. // This will really only fail if the tests were updated. @@ -142,18 +150,24 @@ func main() { } for _, trackerToItem := range trackersTo[trackerIdx].SuccessItems { if _, ok := fromSuccessItems[trackerToItem.Query]; !ok { - if !foundAnySuccessDiff { - foundAnySuccessDiff = true - sb.WriteString("\n## ${\\color{lightgreen}Progressions}$\n") - } - if !foundFileDiff { - foundFileDiff = true - sb.WriteString(fmt.Sprintf("### %s\n", trackersFrom[trackerIdx].File)) + if countProgression <= 50 { + if !foundAnySuccessDiff { + foundAnySuccessDiff = true + sb.WriteString("\n## ${\\color{lightgreen}Progressions}$\n") + } + if !foundFileDiff { + foundFileDiff = true + sb.WriteString(fmt.Sprintf("### %s\n", trackersFrom[trackerIdx].File)) + } + sb.WriteString(fmt.Sprintf("```\nQUERY: %s\n```\n", trackerToItem.Query)) } - sb.WriteString(fmt.Sprintf("```\nQUERY: %s\n```\n", trackerToItem.Query)) + countProgression += 1 } } } + if countProgression > 0 { + sb.WriteString(fmt.Sprintf("\n## ${\\color{lightgreen}Total Progressions: %v}$\n", countProgression)) + } } sb.WriteString("[^1]: These are tests that we're marking as `Successful`, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.") fmt.Println(sb.String()) From 7440530e7034ba9b4e15b9a1e40a9fe1c0a671f2 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 18 Nov 2024 11:01:07 -0800 Subject: [PATCH 7/7] catch more partition of errors (#970) Co-authored-by: James Cor --- server/ast/create_table.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/ast/create_table.go b/server/ast/create_table.go index c5c7e5cab2..0f52614b9e 100644 --- a/server/ast/create_table.go +++ b/server/ast/create_table.go @@ -101,9 +101,11 @@ func nodeCreateTable(ctx *Context, node *tree.CreateTable) (*vitess.DDL, error) } // GMS does not support PARTITION BY, so we parse it and ignore it - ddl.TableSpec.PartitionOpt = &vitess.PartitionOption{ - PartitionType: string(node.PartitionBy.Type), - Expr: vitess.NewColName(string(node.PartitionBy.Elems[0].Column)), + if ddl.TableSpec != nil { + ddl.TableSpec.PartitionOpt = &vitess.PartitionOption{ + PartitionType: string(node.PartitionBy.Type), + Expr: vitess.NewColName(string(node.PartitionBy.Elems[0].Column)), + } } } if node.PartitionOf.Table() != "" {