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

VECTOR Support #146

Merged
merged 5 commits into from
May 24, 2024
Merged

VECTOR Support #146

merged 5 commits into from
May 24, 2024

Conversation

Michael-A-McMahon
Copy link
Member

This branch adds support for the VECTOR data type introduced in Oracle Database 23ai. It requires an update of the Oracle JDBC dependency to version 23.4.

Oracle R2DBC will use the oracle.sql.VECTOR class of Oracle JDBC as the default mapping for VECTOR data. This class provides conversions to and from numeric arrays, such as float[], so I think it will offer a good solution when integrating with ML libraries that also expose vectors as primitive numeric arrays.

Numeric arrays, such as float[] are already defined as a default mapping for ARRAY data. This default mapping appears in Section 14.1 of the R2DBC Specification. Also notable is that a byte[] would be mapped to a RAW by the underlying Oracle JDBC Driver. The need for oracle.sql.VECTOR as an intermediate mapping arises due to these existing mappings.

A new VECTOR type code is added to OracleR2dbcTypes. This type code is used by metadata classes to identify VECTOR data. This type code is also used to register OUT parameters. It can even be used for IN parameters, and this will allow users to directly bind primitive numeric arrays, without the need for an intermediate conversion to oracle.sql.VECTOR.

There is a known defect which will prevent Statement.returningGeneratedValues(String...) from returning VECTOR data. The defect will be resolved in the next release of Oracle JDBC. Strictly speaking, this means Oracle R2DBC does not fully support VECTOR, as it does not support the returningGeneratedValues method. But in all other cases, aside from returning values from DML, I think that almost-but-not-quite-full-support of VECTOR is valuable for our users. Users who need to return VECTOR from DML can use a temporary workaround which I've documented in the README.

@Michael-A-McMahon Michael-A-McMahon self-assigned this May 15, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 15, 2024
@Michael-A-McMahon Michael-A-McMahon linked an issue May 15, 2024 that may be closed by this pull request
@Michael-A-McMahon
Copy link
Member Author

Failing tests will be resolved with #145
These are due to breaking changes in Oracle JDBC 23.4

@jeandelavarene jeandelavarene merged commit 17adf49 into main May 24, 2024
2 checks passed
@jeandelavarene jeandelavarene deleted the 144-vector branch May 24, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support VECTOR
2 participants