-
Notifications
You must be signed in to change notification settings - Fork 114
Introduce Vector type in SQL
#3692
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?
Conversation
- prepared, over JDBC.
- Fix other incorrect tests in DdlStatementParsingTest.java.
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.
Looks good!
I have left some minor comments requesting for additional tests and asking about the jdbc proto message structure
- fix few problems in prepared statement handling and type inference during normalization. - add more tests.
b99830c to
3017412
Compare
| * **Equality comparison** (:sql:`=`, :sql:`!=`) | ||
| * **NULL checks** (:sql:`IS NULL`, :sql:`IS NOT NULL`) | ||
| * **NULL-safe comparison** (:sql:`IS DISTINCT FROM`, :sql:`IS NOT DISTINCT FROM`) | ||
| * **CAST from numeric arrays** to vectors |
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.
Should there be a mention here of the fact that you cannot create value indexes on vectors?
We also probably want to mention that you cannot ORDER BY a vector field at this point.
Can we group by a vector field?
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.
I haven't tested any of that (yet), but I can get to it later (not important for now, but nice to cover for completeness).
...rd-layer-core/src/main/java/com/apple/foundationdb/record/query/expressions/Comparisons.java
Show resolved
Hide resolved
...-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/typing/Type.java
Outdated
Show resolved
Hide resolved
yaml-tests/src/main/java/com/apple/foundationdb/relational/yamltests/server/ExternalServer.java
Outdated
Show resolved
Hide resolved
...-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/RelOpValue.java
Show resolved
Hide resolved
...-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/RelOpValue.java
Show resolved
Hide resolved
...-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/RelOpValue.java
Show resolved
Hide resolved
a2e1628 to
e6dd59c
Compare
📊 Metrics Diff Analysis ReportSummary
ℹ️ About this analysisThis automated analysis compares query planner metrics between the base branch and this PR. It categorizes changes into:
The last category in particular may indicate planner regressions that should be investigated. New QueriesCount of new queries by file:
|
This PR introduces native support for vector data types in the RelationalFDB, enabling storage and querying of fixed-size numerical vectors commonly used in machine learning and similarity search applications through SQL.
The vector type represents a fixed-dimensional array of floating-point numbers with configurable precision. Vectors are declared using the VECTOR(dimension, precision) syntax:
supported precision types are:
HALF- 16-bit half-precision (2 bytes per element)FLOAT- 32-bit single-precision (4 bytes per element)DOUBLE- 64-bit double-precision (8 bytes per element)Key Features
1. Type Conversions:
Cast numeric arrays to vectors with automatic type promotion:
Supports casting from:
INTEGER,BIGINT,FLOAT,DOUBLEarrays.2. Query Operations:
IS NULL,IS NOT NULLIS DISTINCT FROM,IS NOT DISTINCT FROMSimilar to other primitive types, vectors can be used in
struct, and (nullable)arrays.3. JDBC Integration
Vectors are inserted using prepared statements with vector objects:
4. YAML Testing support:
Introduced new YAML tags to enable defining and validating vectors via
!vXX [values]syntax where:!v16represents aHALFprecision vector parameter!v32represents aFLOATprecision vector parameter!v64represents aDOUBLEprecision vector parameterthis fixes #3693, it also rectifies incorrect tests as described in #3695, and (partial) fixes for #3665 as well.