From fe3a88a71d673232ab0500864988d2f81cf61fb8 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 16 Sep 2024 13:29:22 -0700 Subject: [PATCH 1/4] mark vector indexes as unsupported --- enginetest/mysqlshim/table.go | 2 ++ sql/index.go | 5 +++++ sql/plan/alter_index.go | 2 ++ sql/planbuilder/ddl.go | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/enginetest/mysqlshim/table.go b/enginetest/mysqlshim/table.go index 61ada31fba..92c8ac43f8 100644 --- a/enginetest/mysqlshim/table.go +++ b/enginetest/mysqlshim/table.go @@ -217,6 +217,8 @@ func (t Table) CreateIndex(ctx *sql.Context, idx sql.IndexDef) error { statement += " FULLTEXT INDEX" case sql.IndexConstraint_Spatial: statement += " SPATIAL INDEX" + case sql.IndexConstraint_Vector: + statement += " VECTOR INDEX" default: statement += " INDEX" } diff --git a/sql/index.go b/sql/index.go index 7cb05ff557..7b88ce7fa2 100644 --- a/sql/index.go +++ b/sql/index.go @@ -43,6 +43,10 @@ func (i *IndexDef) IsSpatial() bool { return i.Constraint == IndexConstraint_Spatial } +func (i *IndexDef) IsVector() bool { + return i.Constraint == IndexConstraint_Vector +} + func (i *IndexDef) IsPrimary() bool { return i.Constraint == IndexConstraint_Primary } @@ -73,6 +77,7 @@ const ( IndexConstraint_Unique IndexConstraint_Fulltext IndexConstraint_Spatial + IndexConstraint_Vector IndexConstraint_Primary ) diff --git a/sql/plan/alter_index.go b/sql/plan/alter_index.go index c948bc24f3..6abddef049 100644 --- a/sql/plan/alter_index.go +++ b/sql/plan/alter_index.go @@ -227,6 +227,8 @@ func (p AlterIndex) String() string { children = append(children, "Constraint(SPATIAL)") case sql.IndexConstraint_Fulltext: children = append(children, "Constraint(FULLTEXT)") + case sql.IndexConstraint_Vector: + children = append(children, "Constraint(VECTOR)") } switch p.Using { case sql.IndexUsing_BTree, sql.IndexUsing_Default: diff --git a/sql/planbuilder/ddl.go b/sql/planbuilder/ddl.go index d979b969b5..a906b0b979 100644 --- a/sql/planbuilder/ddl.go +++ b/sql/planbuilder/ddl.go @@ -678,8 +678,13 @@ func (b *Builder) buildIndexDefs(_ *scope, spec *ast.TableSpec) (idxDefs sql.Ind constraint = sql.IndexConstraint_Spatial } else if idxDef.Info.Fulltext { constraint = sql.IndexConstraint_Fulltext + } else if idxDef.Info.Vector { + // TODO: different kinds of vector HNSW, IVFFLAT, etc... + constraint = sql.IndexConstraint_Vector + b.handleErr(sql.ErrUnsupportedFeature.New("vector index")) } + columns := b.gatherIndexColumns(idxDef.Columns) var comment string @@ -812,6 +817,9 @@ func (b *Builder) buildAlterIndex(inScope *scope, ddl *ast.DDL, table *plan.Reso constraint = sql.IndexConstraint_Fulltext case ast.SpatialStr: constraint = sql.IndexConstraint_Spatial + case ast.VectorStr: + constraint = sql.IndexConstraint_Vector + b.handleErr(sql.ErrUnsupportedFeature.New("vector index")) case ast.PrimaryStr: constraint = sql.IndexConstraint_Primary default: From 85dc157d3437ed490a1c9f816ec9f97127511ab2 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 16 Sep 2024 13:30:48 -0700 Subject: [PATCH 2/4] bump --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 651cb173a9..36185268db 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e 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-20240913073519-a282f4c775fc + github.com/dolthub/vitess v0.0.0-20240916202548-20dbecf990c7 github.com/go-kit/kit v0.10.0 github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d github.com/gocraft/dbr/v2 v2.7.2 diff --git a/go.sum b/go.sum index cc7ad4f231..4697175cc9 100644 --- a/go.sum +++ b/go.sum @@ -58,10 +58,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-20240912222847-5ea527306043 h1:0gGPPIdXc4ThH/UCl/qBwuXZIaoN9vayXSHDk6HmtLg= -github.com/dolthub/vitess v0.0.0-20240912222847-5ea527306043/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= -github.com/dolthub/vitess v0.0.0-20240913073519-a282f4c775fc h1:vOtgyBF27SgUQzkaQbFyuaouK0uEWG3ZOC3l8h2K6vs= -github.com/dolthub/vitess v0.0.0-20240913073519-a282f4c775fc/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= +github.com/dolthub/vitess v0.0.0-20240916202548-20dbecf990c7 h1:T673T1JpDi9G/Q6NKhN2UANdoSZOIGYBW12/MbrAJmM= +github.com/dolthub/vitess v0.0.0-20240916202548-20dbecf990c7/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= From f6c50861889d48b238f49c4762bf3ff32d4f827b Mon Sep 17 00:00:00 2001 From: jycor Date: Mon, 16 Sep 2024 20:33:10 +0000 Subject: [PATCH 3/4] [ga-format-pr] Run ./format_repo.sh to fix formatting --- sql/planbuilder/ddl.go | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/planbuilder/ddl.go b/sql/planbuilder/ddl.go index a906b0b979..957e7bbaba 100644 --- a/sql/planbuilder/ddl.go +++ b/sql/planbuilder/ddl.go @@ -684,7 +684,6 @@ func (b *Builder) buildIndexDefs(_ *scope, spec *ast.TableSpec) (idxDefs sql.Ind b.handleErr(sql.ErrUnsupportedFeature.New("vector index")) } - columns := b.gatherIndexColumns(idxDef.Columns) var comment string From c6faa080fb0f74bd997161135ad4c1e8f8a36533 Mon Sep 17 00:00:00 2001 From: James Cor Date: Mon, 16 Sep 2024 13:46:05 -0700 Subject: [PATCH 4/4] bump --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 36185268db..9a35c4692b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e 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-20240916202548-20dbecf990c7 + github.com/dolthub/vitess v0.0.0-20240916204416-9d4d4a09b1d9 github.com/go-kit/kit v0.10.0 github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d github.com/gocraft/dbr/v2 v2.7.2 diff --git a/go.sum b/go.sum index 4697175cc9..7f9c2ce409 100644 --- a/go.sum +++ b/go.sum @@ -58,8 +58,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-20240916202548-20dbecf990c7 h1:T673T1JpDi9G/Q6NKhN2UANdoSZOIGYBW12/MbrAJmM= -github.com/dolthub/vitess v0.0.0-20240916202548-20dbecf990c7/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= +github.com/dolthub/vitess v0.0.0-20240916204416-9d4d4a09b1d9 h1:2My8cED5m5/sFay7U4bvLxpECJccKj0cEKCqEA+63yU= +github.com/dolthub/vitess v0.0.0-20240916204416-9d4d4a09b1d9/go.mod h1:uBvlRluuL+SbEWTCZ68o0xvsdYZER3CEG/35INdzfJM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=