Repository navigation
fix(analyticdb): emit native jsonb filter syntax instead of jsonpath - #300
Open
Lubaoshuai wants to merge 1 commit into
Open
Lubaoshuai wants to merge 1 commit into
Lubaoshuai wants to merge 1 commit into
Conversation
The filter expression was rendered with jsonpath syntax ($.key, &&, ||, ==, !()) and double-quoted string values, but QueryCollectionData and DeleteCollectionData splice it straight into a PostgreSQL WHERE clause, where FastANN vector search rejects it (alibaba/spring-ai-alibaba#4962). Emit native syntax instead: metadata->>'key' text extractions, AND/OR keywords, = comparisons, NOT (...) for NIN, and single-quoted string literals with '' escaping. Comparisons against numeric operands cast the extracted text with ::numeric, since PostgreSQL defines no operators between text and numeric types.
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
Heads-up on the failing CLA check: it looks like an infrastructure issue rather than anything about this change. The workflow run errored with "Could not retrieve repository contents. Status: 401" when accessing the signatures repository, which suggests the CLA_REPO_ACCESS_TOKEN secret may have expired or lost access. I have already posted the sign comment, so once the token is fixed a "recheck" should turn this green. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes alibaba/spring-ai-alibaba#4962
Describe what this PR does / why we need it
AdVectorFilterExpressionConverterrendered the filter as jsonpath syntax ($.key,&&/||,==,!()), with double-quoted string values.QueryCollectionDataandDeleteCollectionDatasplice that string straight into a PostgreSQL WHERE clause, and ADB PG FastANN vector search rejects it, so any filtered similarity search fails with a SQL error.This PR emits native syntax instead:
metadata->>'key'jsonb text extractions(metadata->>'key')::numeric, since PostgreSQL defines no comparison operators between text and numeric typesAND/ORkeywords,=comparisons, andNOT (...)for NIN''escaping (double quotes are identifiers in SQL, so they were equally invalid)Does this pull request fix one issue?
Fixes alibaba/spring-ai-alibaba#4962
Testing
New
AdVectorFilterExpressionConverterTest(12 cases, no real ADB credentials needed): equality/comparison, AND/OR, group nesting, IN/NIN, numeric casts, boolean values and quote escaping.mvn testpasses (12 green),spring-javaformat:applyandspotless:checkare clean.