-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support of CREATE|DROP VECTOR INDEX syntax (#84)
* Add support of CREATE|DROP VECTOR INDEX syntax For the syntax documentation, please refer to: https://cloud.google.com/spanner/docs/reference/standard-sql/data-definition-language#vector_index_statements * Add more comments * Move the comment
- Loading branch information
Showing
14 changed files
with
424 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CREATE VECTOR INDEX IF NOT EXISTS hello_vector_index ON hello(embedding) | ||
OPTIONS(distance_type = 'COSINE') |
3 changes: 3 additions & 0 deletions
3
testdata/input/ddl/create_vector_index_where_column_not_null.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CREATE VECTOR INDEX hello_vector_index ON hello(embedding) | ||
WHERE embedding IS NOT NULL | ||
OPTIONS(distance_type = 'COSINE') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP VECTOR INDEX hello_vector_index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- create_vector_index.sql | ||
CREATE VECTOR INDEX IF NOT EXISTS hello_vector_index ON hello(embedding) | ||
OPTIONS(distance_type = 'COSINE') | ||
--- AST | ||
&ast.CreateVectorIndex{ | ||
Create: 0, | ||
IfNotExists: true, | ||
Name: &ast.Ident{ | ||
NamePos: 34, | ||
NameEnd: 52, | ||
Name: "hello_vector_index", | ||
}, | ||
TableName: &ast.Ident{ | ||
NamePos: 56, | ||
NameEnd: 61, | ||
Name: "hello", | ||
}, | ||
ColumnName: &ast.Ident{ | ||
NamePos: 62, | ||
NameEnd: 71, | ||
Name: "embedding", | ||
}, | ||
Where: (*ast.Where)(nil), | ||
Options: &ast.VectorIndexOptions{ | ||
Options: 73, | ||
Rparen: 105, | ||
Records: []*ast.VectorIndexOption{ | ||
&ast.VectorIndexOption{ | ||
Key: &ast.Ident{ | ||
NamePos: 81, | ||
NameEnd: 94, | ||
Name: "distance_type", | ||
}, | ||
Value: &ast.StringLiteral{ | ||
ValuePos: 97, | ||
ValueEnd: 105, | ||
Value: "COSINE", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
--- SQL | ||
CREATE VECTOR INDEX IF NOT EXISTS hello_vector_index ON hello (embedding) OPTIONS (distance_type="COSINE") |
Oops, something went wrong.