Skip to content

Commit

Permalink
[no-release-notes] vector indexes are unsupported (#2659)
Browse files Browse the repository at this point in the history
  • Loading branch information
jycor authored Sep 16, 2024
1 parent b117014 commit 672b271
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
2 changes: 2 additions & 0 deletions enginetest/mysqlshim/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
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-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-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
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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-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=
Expand Down
5 changes: 5 additions & 0 deletions sql/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -73,6 +77,7 @@ const (
IndexConstraint_Unique
IndexConstraint_Fulltext
IndexConstraint_Spatial
IndexConstraint_Vector
IndexConstraint_Primary
)

Expand Down
2 changes: 2 additions & 0 deletions sql/plan/alter_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions sql/planbuilder/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,10 @@ 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)
Expand Down Expand Up @@ -812,6 +816,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:
Expand Down

0 comments on commit 672b271

Please sign in to comment.