HHH-17738 : Add support for Oracle database AI Vector Search

This commit is contained in:
Christian Beikov 2024-05-21 17:26:56 +02:00
parent 60b0a63629
commit a7efb5c9eb
3 changed files with 11 additions and 18 deletions

View File

@ -6,10 +6,6 @@
*/
package org.hibernate.vector;
import java.sql.SQLException;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.hibernate.boot.model.TypeContributions;
import org.hibernate.boot.model.TypeContributor;
import org.hibernate.dialect.Dialect;
@ -19,8 +15,6 @@ import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.BasicArrayType;
import org.hibernate.type.BasicType;
import org.hibernate.type.BasicTypeReference;
import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.SqlTypes;
import org.hibernate.type.StandardBasicTypes;
@ -32,13 +26,11 @@ import org.hibernate.type.spi.TypeConfiguration;
public class OracleVectorTypeContributor implements TypeContributor {
@Override
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
final Dialect dialect = serviceRegistry.requireService( JdbcServices.class )
.getDialect();
final Dialect dialect = serviceRegistry.requireService( JdbcServices.class ).getDialect();
if ( dialect instanceof OracleDialect && dialect.getVersion().isSameOrAfter( 23 ) ) {
if ( dialect instanceof OracleDialect && dialect.getVersion().isSameOrAfter( 23, 4 ) ) {
final TypeConfiguration typeConfiguration = typeContributions.getTypeConfiguration();
final JavaTypeRegistry javaTypeRegistry = typeConfiguration.getJavaTypeRegistry();
final JdbcTypeRegistry jdbcTypeRegistry = typeConfiguration.getJdbcTypeRegistry();

View File

@ -25,13 +25,6 @@ public class VectorArgumentValidator implements ArgumentsValidator {
public static final ArgumentsValidator INSTANCE = new VectorArgumentValidator();
private static final int[] availableVectorCodes = {
SqlTypes.VECTOR,
SqlTypes.VECTOR_INT8,
SqlTypes.VECTOR_FLOAT32,
SqlTypes.VECTOR_FLOAT64
};
@Override
public void validate(
List<? extends SqmTypedNode<?>> arguments,

View File

@ -199,4 +199,12 @@ create table TestEntity (
)
----
For more detailed information please refer to the link:{user-guide-url}#embeddable-inheritance[Embeddable inheritance] user guide chapter.
For more detailed information please refer to the link:{user-guide-url}#embeddable-inheritance[Embeddable inheritance] user guide chapter.
[[oracle-vector]]
== Oracle Vector support
Oracle engineers contributed the support for vector data types and functions to the `hibernate-vector` module
to use with Oracle database version 23.4 and newer.
For further information about vectors, consult the link:https://docs.oracle.com/en/database/oracle/oracle-database/23/vecse/overview-node.html[Oracle documentation].