Skip to content
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

Cosmos: strip implicit casts to allow vector search over arrays #34437

Merged
merged 4 commits into from
Aug 21, 2024

Conversation

roji
Copy link
Member

@roji roji commented Aug 14, 2024

This is a targeted fix to Cosmos, to strip convert nodes out which represent implicit conversions.

I think we need to revisit our general casting/conversion strategy (across both Cosmos and relational), but this specific change makes sense to me...

@ajcvickers can you verify that all vector search tests now pass?

@ajcvickers
Copy link
Member

@roji This is now hacked to allow both arrays and read-only-memories without appropriate overloads or type mappings.

Copy link
Member Author

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your changes look OK, at least for now! See CI test failures, plus you have to approve it (it's my PR originally)

/// </summary>
public override JToken? GenerateJToken(object? value)
{
// This is a hack to allow both arrays and ROM types without different function overloads or type mappings.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't actually seem all that hacky to me! We basically need to do ToArray() because the Cosmos SDK doesn't (yet) natively support ROM, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hacky in the sense that a type mapping with a converter should always be able to pass its value to that converter, but in this case we're using the same type mapping for values that may or may not need converting.

@ajcvickers
Copy link
Member

@roji I tweaked the query changes to fix the failing tests. Can you have a quick look?

Copy link
Member Author

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ajcvickers, LGTM (up to you to approve).

@roji roji enabled auto-merge (squash) August 21, 2024 13:53
@ajcvickers
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@roji roji merged commit 1979607 into dotnet:main Aug 21, 2024
7 checks passed
@roji roji deleted the CosmosVectorStuff branch August 21, 2024 16:49
ajcvickers added a commit that referenced this pull request Aug 21, 2024
Fixes #34402

Co-authored-by: Arthur Vickers <ajcvickers@hotmail.com>
ajcvickers added a commit that referenced this pull request Aug 21, 2024
Fixes #34402

Co-authored-by: Arthur Vickers <ajcvickers@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants