-
Notifications
You must be signed in to change notification settings - Fork 346
Add Support for Vector Data Type in SQL for REST #3677
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
Open
RubenCerna2079
wants to merge
39
commits into
main
Choose a base branch
from
dev/rubencerna/first-changes-vector-type
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+506
−16
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
a0bd291
chore(deps): upgrade to .NET 10 and Microsoft.Data.SqlClient 6.x
souvikghosh04 1064d7f
Update SqlClient 6.1.5
RubenCerna2079 96f5324
Address PR review feedback and align ASP.NET Core packages to 10.x
souvikghosh04 3f5b597
Merge branch 'main' into Usr/sogh/upgrade-net10-sqlclient6
souvikghosh04 280151b
Pin MessagePack to 2.5.301 to fix NU1903 transitive vulnerability
souvikghosh04 1a7d309
Formatting fixes
souvikghosh04 a6ecbb9
Formatting fixes
souvikghosh04 5544ef4
Remove unused variable
souvikghosh04 5e3175b
Fix SqlTestHelper for Microsoft.Data.SqlClient 6.x SqlError construct…
souvikghosh04 f840076
Treat empty ASPNETCORE_URLS as valid in ValidateAspNetCoreUrls
souvikghosh04 ed820fb
Revert unrelated changes to match main (PR review feedback)
souvikghosh04 3735ff4
Fix .NET 10 formatter whitespace/style on Core mutation files
souvikghosh04 a808e13
remove unused variable due to strict check by .Net 10
souvikghosh04 abb49d1
Merge branch 'main' into Usr/sogh/upgrade-net10-sqlclient6
souvikghosh04 fbb8159
try adding DBTYPE_RESOLUTION_ERROR back
souvikghosh04 f3f5583
Removing unused variable which fails in pipeline
souvikghosh04 bd87fa0
Suppress unused variable warning
souvikghosh04 d19a55f
Update SqlClient to 6.1.5
RubenCerna2079 3cc1c0b
First additions to vector data type
RubenCerna2079 2fea5ce
New changes
RubenCerna2079 1e49376
Make vector array type
RubenCerna2079 98e6434
Read
RubenCerna2079 0137653
More changes
RubenCerna2079 e7d72c8
Add write abilities
RubenCerna2079 36ff6eb
Add writing capabilities
RubenCerna2079 8a0edd2
Add tests
RubenCerna2079 c657910
Merge branch 'main' into dev/rubencerna/first-changes-vector-type
RubenCerna2079 ebe6b28
Fix tests
RubenCerna2079 7e45fe2
Fix syntax
RubenCerna2079 aef7af9
Fix syntax error
RubenCerna2079 e479927
Changes based on copilot
RubenCerna2079 0e96e32
Upgrade docker sql version
RubenCerna2079 84b73b1
Fix utf8
RubenCerna2079 99954f6
Upgrade docker sql version
RubenCerna2079 6404bdc
Change to sql 2025 in pipeline
RubenCerna2079 786f98f
Merge remote-tracking branch 'refs/remotes/origin/dev/rubencerna/firs…
RubenCerna2079 f96fefb
Fixed how result is returned in insert
RubenCerna2079 8f2eb92
Changes based on comments
RubenCerna2079 c357a59
Fix syntax
RubenCerna2079 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| using System.Data; | ||
| using System.Globalization; | ||
| using System.Net; | ||
| using System.Text.Json; | ||
| using Azure.DataApiBuilder.Auth; | ||
| using Azure.DataApiBuilder.Config.DatabasePrimitives; | ||
| using Azure.DataApiBuilder.Config.ObjectModel; | ||
|
|
@@ -452,10 +453,50 @@ protected static object ParseParamAsSystemType(string param, Type systemType) | |
| "Guid" => Guid.Parse(param), | ||
| "TimeOnly" => TimeOnly.Parse(param), | ||
| "TimeSpan" => TimeOnly.Parse(param), | ||
| "Single[]" => ParseArrayIntoSystemType(param, systemType), | ||
| _ => throw new NotSupportedException($"{systemType.Name} is not supported") | ||
| }; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Takes the array of the parameter we are going to parse and converts each element to the specified system type. | ||
| /// </summary> | ||
| /// <param name="param"></param> | ||
| /// <param name="systemType"></param> | ||
| /// <returns></returns> | ||
| /// <exception cref="NotSupportedException"></exception> | ||
| /// <exception cref="FormatException"></exception> | ||
| private static object ParseArrayIntoSystemType(string param, Type systemType) | ||
|
Contributor
Author
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. With this pattern we can also write to other array values such as the ones found in PostgreSQL. Let me know if you think this is viable.
RubenCerna2079 marked this conversation as resolved.
|
||
| { | ||
| Type typeOfArray; | ||
| switch (systemType.Name) | ||
| { | ||
| case "Single[]": | ||
| typeOfArray = typeof(Single); | ||
| break; | ||
|
|
||
| default: | ||
| throw new NotSupportedException($"{systemType.Name} is not supported"); | ||
| } | ||
|
|
||
| try | ||
| { | ||
| List<object> list = new(); | ||
| object[] values = JsonSerializer.Deserialize<object[]>(param) ?? Array.Empty<object>(); | ||
| for (int i = 0; i < values.Length; i++) | ||
| { | ||
| string stringValue = values[i]?.ToString() ?? string.Empty; | ||
| values[i] = ParseParamAsSystemType(stringValue, typeOfArray); | ||
| } | ||
|
|
||
| return values; | ||
| } | ||
| catch | ||
| { | ||
| throw new FormatException($"Expected an array for {systemType.Name} but got an unexpected value"); | ||
| } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Very similar to GQLArgumentToDictParams but only extracts the argument names from | ||
| /// the specified field which means that the method does not need a middleware context | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.