-
Notifications
You must be signed in to change notification settings - Fork 767
Support CREATE VECTOR INDEX
#2437
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2941,3 +2941,12 @@ fn parse_bracket_quoted_function_argument_name() { | |||||||||||
| }]) | ||||||||||||
| ); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| #[test] | ||||||||||||
| fn parse_mssql_create_vector_index() { | ||||||||||||
| // SQL Server's form: bracket-quoted names and a `WITH (...)` options clause | ||||||||||||
| // (`METRIC` / `TYPE` / `MAXDOP`). | ||||||||||||
| ms().verified_stmt( | ||||||||||||
| "CREATE VECTOR INDEX vec_idx ON [dbo].[articles]([title_vector]) WITH (METRIC = 'cosine', TYPE = 'DiskANN', MAXDOP = 8)", | ||||||||||||
| ); | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The ON syntax from SQL Server CREATE VECTOR INDEX grammar still does not parse, here is a red test for it:
Suggested change
|
||||||||||||
| } | ||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -539,3 +539,13 @@ fn test_insert_without_alias() { | |||||||||||||||||||
| if matches!(&*source, Query { body, .. } if matches!(&**body, SetExpr::Values(_))) | ||||||||||||||||||||
| )); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #[test] | ||||||||||||||||||||
| fn parse_oracle_create_vector_index() { | ||||||||||||||||||||
| // Oracle's specialized clauses (ORGANIZATION / DISTANCE / WITH TARGET | ||||||||||||||||||||
| // ACCURACY / PARAMETERS) are not yet parsed; the forms it shares with the | ||||||||||||||||||||
| // common grammar — an expression target and an `INCLUDE` list — round-trip. | ||||||||||||||||||||
| oracle().verified_stmt("CREATE VECTOR INDEX g_idx ON galaxies(embedding)"); | ||||||||||||||||||||
| oracle().verified_stmt("CREATE VECTOR INDEX g_idx ON galaxies(VEC_DISTANCE(embedding))"); | ||||||||||||||||||||
| oracle().verified_stmt("CREATE VECTOR INDEX g_idx ON galaxies(embedding) INCLUDE (id)"); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+543
to
+551
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None of these inputs are valid Oracle statements, and the common test already covers permissive parsing of the shared prefix across every dialect. Since correct Oracle statements are not currently supported, it does not make sense to test for incorrect ones even though this implementation parses them without erroring out, which I am unsure whether that is desirable.
Suggested change
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After adding the keyword, you can now replace this with: