Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
b975738
EXP: Implement PostgreSQL adapter expansion for schema detection, dat…
yabsp Mar 18, 2026
b7895d6
Introduce feature system for SQL dialects along with feature detectio…
yabsp Mar 25, 2026
4d5fc6f
Enable image variant selectivity for PostgreSQL stores
yabsp Mar 26, 2026
a17c660
Cleanup code
yabsp Apr 1, 2026
a657558
Add non-parameterized L1/L2/COS_DISTANCE functions
yabsp Apr 2, 2026
275a50f
DEBUG: Change default registry and log level
yabsp Apr 3, 2026
40ef27d
Extend pushdown translation to include bitvectors
yabsp Apr 6, 2026
ad2dd24
Register certain parameterized distance functions as non-parameterize…
yabsp Apr 11, 2026
520e2da
Add better operand unparsing for dynamic parameters
yabsp Apr 11, 2026
38f143c
Revert "DEBUG: Change default registry and log level"
yabsp Apr 11, 2026
e3de020
DEBUG: Change default postgres adapter image to align with polypheny …
yabsp Apr 11, 2026
9437985
FIX: Switch Vector handling from PolyTypes to Strings for flawless PI…
yabsp Apr 11, 2026
aa2758e
Revert "DEBUG: Change default postgres adapter image to align with po…
yabsp Apr 12, 2026
f17d200
Add a VectorType marking certain ArrayTypes
yabsp Apr 14, 2026
95b3d15
Promote FLOAT/REAL 1D arrays to VectorType, adjust createVectorType a…
yabsp Apr 16, 2026
b05e10f
DEBUG: Change default postgres adapter image to align with polypheny …
yabsp Apr 18, 2026
3e061ea
FIX: Time zone mismatch in ComplexViewTest
yabsp Apr 12, 2026
ae6102f
Change createVectorType from default to abstract
yabsp Apr 21, 2026
59003f0
Enable vector cross join and filter pushdown to JDBC
yabsp Apr 21, 2026
d37998d
Add pgvector distance operators (<->, <+>, <=>) with integration tests
yabsp Apr 22, 2026
33306ff
Promote fixed-dimension FLOAT and BOOLEAN arrays to VectorType in typ…
yabsp Apr 28, 2026
bd5f2be
Add dialect extension points for vector literals and fix precision un…
yabsp Apr 28, 2026
0e9e626
Bind and read VectorType columns correctly in JDBC adapter framework
yabsp Apr 28, 2026
cd8fd62
Preserve VectorType identity when deriving parameter types in prepare…
yabsp Apr 28, 2026
fd235b0
Add requiresNativeTypeResolution hook for dialect specific type resol…
yabsp Apr 28, 2026
832ce95
Add bitvector support in PostgreSQL adapter
yabsp Apr 28, 2026
730ff72
Add and reorganize PostgreSQL adapter tests with bitvector and source…
yabsp Apr 28, 2026
10d3139
Correct depencency for PostgresqlSourceDiscoveryTest
yabsp Apr 28, 2026
6a94bec
Add concrete type registration for PGgeometry
yabsp Apr 29, 2026
bfe5c04
Update PIPreparedNamedStatement to keep the correct ARRAY information…
yabsp May 1, 2026
829ee7e
Extend distance functions with hamming and jaccard non-parameterized …
yabsp May 1, 2026
b4f2b0e
Add tests for hamming and jaccard operators (<~>, <%>)
yabsp May 1, 2026
d45d693
Add Hamming and Jaccard operators to excluded MongoDB visitors
yabsp May 2, 2026
41e9b8e
Extend feature support to remote stores
yabsp May 2, 2026
70ec04b
Extends the type system and catalog to track "elementsNullable" for a…
yabsp May 6, 2026
6de41f2
Fix: Preserve VectorType explicit casts during algebraic conversion
yabsp May 6, 2026
621ff66
Fix: Handle generic numerical types during PostgreSQL vector creation
yabsp May 6, 2026
a02cf92
Add test coverage for VectorType insertions and element nullability
yabsp May 6, 2026
ea8a9ab
Fix: Possible null values in componentType
yabsp May 6, 2026
45772a9
Fix: Neo4j null value handling in fixParameterValue
yabsp May 7, 2026
048ca4f
Implement MQL vectorSearch syntax
yabsp May 9, 2026
fa76003
Extend Adapter capabilities to provide available features
yabsp May 10, 2026
d9f6368
Extend validation steps for MQL queries checking array-metric-consis…
yabsp May 12, 2026
bada50a
FIX: Time zone mismatch in ComplexViewTest
yabsp Apr 12, 2026
7f32a0e
Bump bouncycastle version and replace hardcoded version with declared…
yabsp May 19, 2026
6089125
Implement Cypher native 'vector_distance' syntax
yabsp May 19, 2026
fa38049
Change distance function access modifier
yabsp May 19, 2026
bc7acd3
Change PostgreSQL image variant names to match new images
yabsp May 19, 2026
41459bc
DEBUG: Add image variant for old postgres:latest image
yabsp May 19, 2026
a8052d7
Add test coverage for MQL and Cypher vector search syntax
yabsp May 19, 2026
eef12a0
Apply code formatting to postgres-adapter plugin
yabsp May 19, 2026
bf08700
Document PostgresqlImageVariant and SqlDbFeature registration flow
yabsp May 19, 2026
610dc26
Fix string parsing for list past to distance functions and adjust neo…
yabsp May 21, 2026
d4a475d
Group index into categories and adapt createIndex
yabsp May 25, 2026
04e776c
Extend IndexMethodModel to include category and parameters
yabsp May 25, 2026
391b64b
Extend index creation for PostgreSQL, hnsw and ivfflat defaulting to …
yabsp May 25, 2026
5238084
Thread index options from UI API down to catalog layer
yabsp May 25, 2026
3f620c9
Dynamically resolve operator classes for pgvector indexes based on op…
yabsp May 25, 2026
14aab81
EXP: Change Crud index creation to diretly use the DdlManager
yabsp May 25, 2026
c1c696a
Fix VectorType derivation in PIPreparedStatement
yabsp May 28, 2026
546c3ab
Remove placeholder image variant for PostgreSQL stores
yabsp May 28, 2026
8f1d443
Add WITH (key=value) syntax to ALTER TABLE ADD INDEX for pgvector ind…
yabsp May 29, 2026
81207a0
Revert "EXP: Change Crud index creation to diretly use the DdlManager"
yabsp May 29, 2026
9bb5d39
Parse WITH clause correctly in Crud
yabsp May 29, 2026
c30fe83
Improve vector index validation in DdlManagerImpl
yabsp May 29, 2026
f407b11
Add elementsNullable to webui ColumnModel
yabsp May 29, 2026
ccdc260
Add inner product (IP) distance metric and <#> pgvector operator
yabsp May 29, 2026
a22e92c
Preserve element nullability and VectorType on column modifications
yabsp May 31, 2026
b05aad1
Extend visible index parameters for UI and fix PostgreSQL index delet…
yabsp May 31, 2026
6ad45ab
Rename IP to INNER_PRODUCT
yabsp Jun 1, 2026
7ff4b7d
Provide parameter data for UI
yabsp Jun 1, 2026
b618fd5
Fix bit vector distance pushdown to PostgreSQL
yabsp Jun 4, 2026
0729d1d
Provide adapter deployment presets and feature display names for the UI
yabsp Jul 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/src/main/java/org/polypheny/db/adapter/Adapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,8 @@ protected void resetDockerConnection() {
}


public List<String> getActiveFeatureNames() {
return List.of();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.calcite.linq4j.tree.Expressions;
import org.jetbrains.annotations.NotNull;
import org.polypheny.db.adapter.annotations.AdapterProperties;
import org.polypheny.db.adapter.annotations.AdapterSettingsPreset;
import org.polypheny.db.adapter.java.AdapterTemplate;
import org.polypheny.db.catalog.Catalog;
import org.polypheny.db.catalog.entity.LogicalAdapter;
Expand Down Expand Up @@ -65,8 +66,10 @@ private AdapterManager() {
public static long addAdapterTemplate( Class<? extends Adapter<?>> clazz, String adapterName, DeployFn deployer ) {
List<AbstractAdapterSetting> settings = AdapterTemplate.getAllSettings( clazz );
AdapterProperties properties = clazz.getAnnotation( AdapterProperties.class );
List<DeployMode> modes = List.of( properties.usedModes() );
List<AdapterSettingsPreset> presets = AdapterTemplate.getAllPresets( clazz, settings, modes );
long id = AdapterManager.getInstance().idBuilder.getAndIncrement();
AdapterManager.getInstance().adapterTemplates.put( id, new AdapterTemplate( id, clazz, adapterName, settings, List.of( properties.usedModes() ), properties.description(), deployer ) );
AdapterManager.getInstance().adapterTemplates.put( id, new AdapterTemplate( id, clazz, adapterName, settings, modes, presets, properties.description(), deployer ) );
return id;
}

Expand Down
21 changes: 19 additions & 2 deletions core/src/main/java/org/polypheny/db/adapter/DataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.polypheny.db.catalog.Catalog;
import org.polypheny.db.catalog.catalogs.AdapterCatalog;
import org.polypheny.db.catalog.entity.logical.LogicalTable;
import org.polypheny.db.catalog.logistic.IndexCategory;

@Slf4j
public abstract class DataStore<S extends AdapterCatalog> extends Adapter<S> implements Modifiable, ExtensionPoint {
Expand All @@ -52,11 +53,27 @@ public DataStore( final long adapterId, final String uniqueName, final Map<Strin
public abstract List<FunctionalIndexInfo> getFunctionalIndexes( LogicalTable catalogTable );


public record IndexMethodModel( @JsonProperty String name, @JsonProperty String displayName ) {

public record IndexMethodModel(
@JsonProperty String name,
@JsonProperty String displayName,
@JsonProperty IndexCategory category,
@JsonProperty List<IndexParameterModel> parameters
) {
public IndexMethodModel( String name, String displayName ) {
this( name, displayName, IndexCategory.REGULAR, List.of() );
}
}


public record IndexParameterModel(
@JsonProperty String name,
@JsonProperty String displayName,
@JsonProperty String type, //INTEGER, BOOLEAN, ENUM
@JsonProperty List<String> options,
@JsonProperty String defaultValue
){}


public record FunctionalIndexInfo( List<Long> columnIds, String methodDisplayName ) {

public List<String> getColumnNames() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface RelationalDataSource {

Map<String, List<ExportedColumn>> getExportedColumns();

record ExportedColumn( String name, PolyType type, PolyType collectionsType, Integer length, Integer scale, Integer dimension, Integer cardinality, boolean nullable, String physicalSchemaName, String physicalTableName, String physicalColumnName, int physicalPosition, boolean primary ) {
record ExportedColumn( String name, PolyType type, PolyType collectionsType, Integer length, Integer scale, Integer dimension, Integer cardinality, boolean nullable, boolean elementsNullable, String physicalSchemaName, String physicalTableName, String physicalColumnName, int physicalPosition, boolean primary ) {

public String getDisplayType() {
String typeStr = type.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public void dropGraph( Context context, AllocationGraph allocation ) {
@Override
public List<PhysicalEntity> createCollection( Context context, LogicalCollection logical, AllocationCollection allocation ) {
PhysicalTable physical = Scannable.createSubstitutionTable( modifiable, context, logical, allocation, "_doc_", List.of(
new ColumnContext( DocumentType.DOCUMENT_ID, null, PolyType.TEXT, false ),
new ColumnContext( DocumentType.DOCUMENT_DATA, null, PolyType.TEXT, true ) ), 1 );
new ColumnContext( DocumentType.DOCUMENT_ID, null, PolyType.TEXT, false, true ),
new ColumnContext( DocumentType.DOCUMENT_DATA, null, PolyType.TEXT, true, true ) ), 1 );
catalog.addPhysical( allocation, physical );

return List.of( physical );
Expand Down
32 changes: 16 additions & 16 deletions core/src/main/java/org/polypheny/db/adapter/Scannable.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static PhysicalEntity createSubstitutionEntity( Scannable scannable, Context con

int i = 0;
for ( ColumnContext col : columnsInformations ) {
LogicalColumn column = new LogicalColumn( builder.getNewFieldId(), col.name, table.id, table.namespaceId, i, col.type, null, col.precision, null, null, null, col.nullable, Collation.getDefaultCollation(), null );
LogicalColumn column = new LogicalColumn( builder.getNewFieldId(), col.name, table.id, table.namespaceId, i, col.type, null, col.precision, null, null, null, col.nullable, col.elementsNullable, Collation.getDefaultCollation(), null );
columns.add( column );
i++;
}
Expand Down Expand Up @@ -170,24 +170,24 @@ static AlgNode getDocumentScanSubstitute( Scannable scannable, long allocId, Alg

static List<PhysicalEntity> createGraphSubstitute( Scannable scannable, Context context, LogicalGraph logical, AllocationGraph allocation ) {
PhysicalEntity node = createSubstitutionEntity( scannable, context, logical, allocation, "_node_", List.of(
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false ),
new ColumnContext( "label", null, PolyType.TEXT, false ) ), 2 );
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false, true ),
new ColumnContext( "label", null, PolyType.TEXT, false, true ) ), 2 );

PhysicalEntity nProperties = createSubstitutionEntity( scannable, context, logical, allocation, "_nProperties_", List.of(
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false ),
new ColumnContext( "key", null, PolyType.TEXT, false ),
new ColumnContext( "value", null, PolyType.TEXT, true ) ), 2 );
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false, true ),
new ColumnContext( "key", null, PolyType.TEXT, false, true ),
new ColumnContext( "value", null, PolyType.TEXT, true, true ) ), 2 );

PhysicalEntity edge = createSubstitutionEntity( scannable, context, logical, allocation, "_edge_", List.of(
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false ),
new ColumnContext( "label", null, PolyType.TEXT, true ),
new ColumnContext( "_l_id_", GraphType.ID_SIZE, PolyType.VARCHAR, true ),
new ColumnContext( "_r_id_", GraphType.ID_SIZE, PolyType.VARCHAR, true ) ), 1 );
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false, true ),
new ColumnContext( "label", null, PolyType.TEXT, true, true ),
new ColumnContext( "_l_id_", GraphType.ID_SIZE, PolyType.VARCHAR, true, true ),
new ColumnContext( "_r_id_", GraphType.ID_SIZE, PolyType.VARCHAR, true, true ) ), 1 );

PhysicalEntity eProperties = createSubstitutionEntity( scannable, context, logical, allocation, "_eProperties_", List.of(
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false ),
new ColumnContext( "key", null, PolyType.TEXT, false ),
new ColumnContext( "value", null, PolyType.TEXT, true ) ), 2 );
new ColumnContext( "id", GraphType.ID_SIZE, PolyType.VARCHAR, false, true ),
new ColumnContext( "key", null, PolyType.TEXT, false, true ),
new ColumnContext( "value", null, PolyType.TEXT, true, true ) ), 2 );

scannable.getCatalog().addPhysical( allocation, node, nProperties, edge, eProperties );
return List.of( node, nProperties, edge, eProperties );
Expand Down Expand Up @@ -222,8 +222,8 @@ static void dropGraphSubstitute( Scannable scannable, Context context, Allocatio

static List<PhysicalEntity> createCollectionSubstitute( Scannable scannable, Context context, LogicalCollection logical, AllocationCollection allocation ) {
PhysicalEntity doc = createSubstitutionEntity( scannable, context, logical, allocation, "_doc_", List.of(
new ColumnContext( DocumentType.DOCUMENT_ID, null, PolyType.TEXT, false ),
new ColumnContext( DocumentType.DOCUMENT_DATA, null, PolyType.TEXT, false ) ), 1 );
new ColumnContext( DocumentType.DOCUMENT_ID, null, PolyType.TEXT, false, true ),
new ColumnContext( DocumentType.DOCUMENT_DATA, null, PolyType.TEXT, false, true ) ), 1 );

scannable.getCatalog().addPhysical( allocation, doc );
return List.of( doc );
Expand All @@ -250,7 +250,7 @@ static void dropCollectionSubstitute( Scannable scannable, Context context, Allo
void renameLogicalColumn( long id, String newColumnName );


record ColumnContext( String name, Integer precision, PolyType type, boolean nullable ) {
record ColumnContext( String name, Integer precision, PolyType type, boolean nullable, boolean elementsNullable ) {

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2019-2026 The Polypheny Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


package org.polypheny.db.adapter.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.polypheny.db.adapter.DeployMode;
import org.polypheny.db.adapter.annotations.AdapterSettingsPreset.List;

/**
* Declares a named deployment preset for an adapter: a deploy mode together with
* predefined values for some of its settings. Presets are offered in the UI as
* one-click deploy options, all settings not covered by the preset keep their
* default values.
*/
@Inherited
@Repeatable(List.class)
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface AdapterSettingsPreset {

String name();

String description() default "";

DeployMode mode();

Setting[] settings();

@Inherited
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@interface List {

AdapterSettingsPreset[] value();

}

@Target({})
@Retention(RetentionPolicy.RUNTIME)
@interface Setting {

String name();

String value();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.polypheny.db.adapter.DeployMode;
import org.polypheny.db.adapter.DeployMode.DeploySetting;
import org.polypheny.db.adapter.annotations.AdapterProperties;
import org.polypheny.db.adapter.annotations.AdapterSettingsPreset;
import org.polypheny.db.catalog.entity.LogicalAdapter.AdapterType;
import org.polypheny.db.catalog.exceptions.GenericRuntimeException;
import org.polypheny.db.docker.DockerManager;
Expand All @@ -44,17 +45,19 @@ public class AdapterTemplate {
DeployFn deployer;
public List<AbstractAdapterSetting> settings;
public List<DeployMode> modes;
public List<AdapterSettingsPreset> presets;
public long id;
public String description;


public AdapterTemplate( long id, Class<?> clazz, String adapterName, List<AbstractAdapterSetting> settings, List<DeployMode> modes, String description, DeployFn deployer ) {
public AdapterTemplate( long id, Class<?> clazz, String adapterName, List<AbstractAdapterSetting> settings, List<DeployMode> modes, List<AdapterSettingsPreset> presets, String description, DeployFn deployer ) {
this.id = id;
this.adapterName = adapterName;
this.description = description;
this.clazz = clazz;
this.settings = settings;
this.modes = modes;
this.presets = presets;
this.adapterType = getAdapterType( clazz );
this.deployer = deployer;
}
Expand Down Expand Up @@ -85,6 +88,30 @@ public static List<AbstractAdapterSetting> getAllSettings( Class<? extends Adapt
}


/**
* Collects the deployment presets declared via {@link AdapterSettingsPreset} on the adapter class
* and validates them against the adapter's settings and supported deploy modes.
*/
public static List<AdapterSettingsPreset> getAllPresets( Class<? extends Adapter<?>> clazz, List<AbstractAdapterSetting> settings, List<DeployMode> modes ) {
List<AdapterSettingsPreset> presets = Arrays.asList( clazz.getAnnotationsByType( AdapterSettingsPreset.class ) );
for ( AdapterSettingsPreset preset : presets ) {
if ( !modes.contains( preset.mode() ) ) {
throw new GenericRuntimeException( "Preset '%s' of adapter %s uses deploy mode %s, which the adapter does not support.", preset.name(), clazz.getSimpleName(), preset.mode() );
}
for ( AdapterSettingsPreset.Setting entry : preset.settings() ) {
AbstractAdapterSetting setting = settings.stream()
.filter( s -> s.name.equals( entry.name() ) )
.findFirst()
.orElseThrow( () -> new GenericRuntimeException( "Preset '%s' of adapter %s references the unknown setting '%s'.", preset.name(), clazz.getSimpleName(), entry.name() ) );
if ( setting instanceof AbstractAdapterSettingList list && !list.options.contains( entry.value() ) ) {
throw new GenericRuntimeException( "Preset '%s' of adapter %s uses the value '%s' for setting '%s', which is not one of its options.", preset.name(), clazz.getSimpleName(), entry.value(), entry.name() );
}
}
}
return presets;
}


public Map<String, String> getDefaultSettings() {
Map<String, String> map = new HashMap<>();
for ( AbstractAdapterSetting s : settings ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public enum FunctionCategory {
USER_DEFINED_TABLE_SPECIFIC_FUNCTION( "TABLE_UDF_SPECIFIC", "User-defined table function with SPECIFIC name", USER_DEFINED, TABLE_FUNCTION, SPECIFIC ),
MATCH_RECOGNIZE( "MATCH_RECOGNIZE", "MATCH_RECOGNIZE function", TABLE_FUNCTION ),
DISTANCE( "DISTANCE", "distance function", DISTANCE_FUNCTION ),
L1_DISTANCE( "L1_DISTANCE", "l1 distance function", DISTANCE_FUNCTION ),
L2_DISTANCE( "L2_DISTANCE", "l2 distance function", DISTANCE_FUNCTION ),
COS_DISTANCE( "COS_DISTANCE", "cosine distance function", DISTANCE_FUNCTION ),
HAMMING_DISTANCE( "HAMMING_DISTANCE", "hamming distance function", DISTANCE_FUNCTION ),
JACCARD_DISTANCE( "JACCARD_DISTANCE", "jaccard distance function", DISTANCE_FUNCTION ),
INNER_PRODUCT_DISTANCE( "INNER_PRODUCT_DISTANCE", "inner product distance function", DISTANCE_FUNCTION ),
MULTIMEDIA( "MULTIMEDIA", "Multimedia function", MULTIMEDIA_FUNCTION ),
GEOMETRY( "GEOMETRY", "Geo function", GEO_FUNCTION );

Expand Down
12 changes: 12 additions & 0 deletions core/src/main/java/org/polypheny/db/algebra/constant/Kind.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ public enum Kind {
*/
DISTANCE,

L1_DISTANCE,

L2_DISTANCE,

COS_DISTANCE,

HAMMING_DISTANCE,

JACCARD_DISTANCE,

INNER_PRODUCT_DISTANCE,

/**
* GEO functions.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ public Expression implement( RexToLixTranslator translator, RexCall call, List<E
defineMethod( OperatorRegistry.get( OperatorName.TAN ), "tan", NullPolicy.STRICT );
defineMethod( OperatorRegistry.get( OperatorName.TRUNCATE ), "struncate", NullPolicy.STRICT );
defineMethod( OperatorRegistry.get( OperatorName.DISTANCE ), "distance", NullPolicy.ANY );
defineMethod( OperatorRegistry.get( OperatorName.L1_DISTANCE ), "l1Distance", NullPolicy.ANY);
defineMethod( OperatorRegistry.get( OperatorName.L2_DISTANCE ), "l2Distance", NullPolicy.ANY);
defineMethod( OperatorRegistry.get( OperatorName.COS_DISTANCE ), "cosDistance", NullPolicy.ANY);
defineMethod( OperatorRegistry.get( OperatorName.HAMMING_DISTANCE ), "hammingDistance", NullPolicy.ANY);
defineMethod( OperatorRegistry.get( OperatorName.JACCARD_DISTANCE ), "jaccardDistance", NullPolicy.ANY);
defineMethod( OperatorRegistry.get( OperatorName.INNER_PRODUCT_DISTANCE ), "innerProductDistance", NullPolicy.ANY);
defineMethod( OperatorRegistry.get( OperatorName.META ), "meta", NullPolicy.ANY );

map.put( OperatorRegistry.get( OperatorName.PI ), ( translator, call, nullAs ) -> PolyDouble.of( Math.PI ).asExpression() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,40 @@ public enum OperatorName {
*/
ST_GEOMETRYN( Function.class ),

//------------------------------------------------------------
// VECTOR DISTANCE FUNCTIONS
//------------------------------------------------------------

L2_DISTANCE( Function.class ),

L1_DISTANCE( Function.class ),

COS_DISTANCE( Function.class ),

HAMMING_DISTANCE( Function.class ),

JACCARD_DISTANCE( Function.class ),

INNER_PRODUCT_DISTANCE( Function.class ),

// Cypher specific operator
VECTOR_DISTANCE( Function.class),


// PostgreSQL pgvector Operators

PGVECTOR_L2( BinaryOperator.class ),

PGVECTOR_L1( BinaryOperator.class ),

PGVECTOR_COS( BinaryOperator.class ),

PGVECTOR_HAMMING( BinaryOperator.class ),

PGVECTOR_JACCARD( BinaryOperator.class ),

PGVECTOR_INNER_PRODUCT( BinaryOperator.class ),

//-------------------------------------------------------------
// SET OPERATORS
//-------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ public interface AlgDataTypeFactory {
*/
AlgDataType createArrayType( AlgDataType elementType, long maxCardinality, long dimension );

/**
* Creates a vector type. A vector is a fixed-length, single-dimension array
of numeric values (i.e. dim=1, card=k).
*
* @param elementType the element type (typically {@code FLOAT/REAL} or {@code BOOLEAN (BIT)})
* @param dimension the fixed number of elements in the vector, corresponds to cardinality of an array.
* @return canonical vector type descriptor
*/
AlgDataType createVectorType( AlgDataType elementType, long dimension );

/**
* Creates a map type. Maps are unordered collections of key/value pairs.
*
Expand Down
Loading
Loading