Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0b30b35
DEBUG: Add task to run without jar
yabsp Apr 4, 2026
7f7fa09
DEBUG: Change KnnBench to work properly on run
yabsp Apr 4, 2026
68cc067
DEBUG: Modify build.gradle to be runnable from cli
yabsp Apr 5, 2026
d971239
Add vectorbench scenario mirroring knnbench with adjustements
yabsp Apr 7, 2026
2f79133
DEBUG: Change log level to debug
yabsp Apr 7, 2026
ac934be
FIX: Proper synchronization for writeLine method
yabsp Apr 7, 2026
24bd3bd
Revert "DEBUG: Change log level to debug"
yabsp Apr 16, 2026
d247424
Change queries to follow the parameterized function pattern again
yabsp Apr 16, 2026
31cddf4
Add new query types containing distance cross-joins
yabsp Apr 17, 2026
44a960c
Add creation, insertion and queries for boolean vectors
yabsp May 26, 2026
a6d2ec8
Move create and insert QueryBuilders to new package and add "category…
yabsp May 26, 2026
a4adda0
Add new SimpleKnnRealFeatureFiltered QueryBuilder
yabsp May 26, 2026
3c1a6b4
Adapt already existing structure to support new changes
yabsp May 26, 2026
d3b49c7
Restructure VectorBench scenario
yabsp May 26, 2026
7c8c924
Add QueryBuilders for PostgreSQL native queries
yabsp May 27, 2026
f6d6241
Adapt VectorCommand, VectorBenchScenario, and VectorBenchConfig to su…
yabsp May 27, 2026
22fa024
Add remaining adaptations caused by new QueryBuilders
yabsp May 27, 2026
ff0e2d4
Add useIndex option to vector.properties
yabsp May 27, 2026
995a898
Fix typo
yabsp May 27, 2026
48dd085
Revert changes to build.gradle used for local testing
yabsp May 27, 2026
547feb3
Add index creation QueryBuilders
yabsp Jun 1, 2026
03a774e
Implement recall analysis
yabsp Jun 1, 2026
ab40958
Extend property parameters
yabsp Jun 1, 2026
e68ebe8
Add Chronos vectorbench case and helper method in JdbcExecutor
yabsp Jun 1, 2026
ef78c9a
Add recall-groundtruth.csv to .gitignore
yabsp Jun 1, 2026
0d4ffed
Adjust Chronos vectorbench workflows to ignore recall
yabsp Jun 1, 2026
32991ad
Change postgres image in ChronosAgent
yabsp Jun 1, 2026
36444cb
Add inner product to metrics and document available metrics in proper…
yabsp Jun 1, 2026
329e27e
Use dynamic adapter names
yabsp Jun 3, 2026
1df1de6
Enable postgres image variant injection
yabsp Jun 4, 2026
6093ab5
Add supportsNotNullArray flag
yabsp Jun 4, 2026
8eaa0e7
Add new QueryBuilders for direct PostgreSQL querying
yabsp Jun 4, 2026
14e9cd1
Integrate new PostgreSQL QueryBuilders
yabsp Jun 4, 2026
720172f
Rename ip to inner_product and update properties and README
yabsp Jun 4, 2026
1a394e9
Set featureStore and metadataStore for CLI path
yabsp Jun 4, 2026
57ef308
Write recall summary to file on CLI path of vectorbench
yabsp Jun 8, 2026
ba6299b
Fix date in copyright headers
yabsp Jul 20, 2026
134635a
Revert changes to KnnBench and cleanup code
yabsp Jul 20, 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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,13 @@ nbdist/
# Avoid ignoring PolySqlParser jar file (.jar files are usually ignored)
!/libs/PolySqlParser-1.0.jar

# vectorbench CLI path
/results.csv
/results-pg.csv
/recall-groundtruth.csv
/recall.csv

# humble video libraries
libhumblevideo-0.dll
libhumblevideo.dylib
libhumblevideo.so
libhumblevideo.so
1 change: 1 addition & 0 deletions src/main/java/org/polypheny/simpleclient/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static void main( String[] args ) throws SQLException {
builder.withCommands( ComsCommand.class );
builder.withCommands( GavelCommand.class );
builder.withCommands( KnnCommand.class );
builder.withCommands( VectorCommand.class );
builder.withCommands( MultimediaCommand.class );
builder.withCommands( GraphCommand.class );
builder.withCommands( DocBenchCommand.class );
Expand Down
123 changes: 123 additions & 0 deletions src/main/java/org/polypheny/simpleclient/cli/VectorCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019-2026 The Polypheny Project
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package org.polypheny.simpleclient.cli;

import com.github.rvesse.airline.HelpOption;
import com.github.rvesse.airline.annotations.AirlineModule;
import com.github.rvesse.airline.annotations.Arguments;
import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;
import lombok.extern.slf4j.Slf4j;
import org.polypheny.simpleclient.executor.Executor.ExecutorFactory;
import org.polypheny.simpleclient.executor.PolyphenyDbJdbcExecutor.PolyphenyDbJdbcExecutorFactory;
import org.polypheny.simpleclient.main.VectorBenchScenario;
import java.sql.SQLException;
import java.util.List;

@Slf4j
@Command(name = "vector", description = "Mode for quick testing of Polypheny-DB using the vector benchmark.")
public class VectorCommand implements CliRunnable {

@AirlineModule
private HelpOption<VectorCommand> help;

@Arguments(description = "Task { schema | data | groundtruth | index | workload | warmup | recall } and multiplier.")
private List<String> args;


@Option(name = { "-pdb", "--polyphenydb" }, title = "IP or Hostname", arity = 1, description = "IP or Hostname of the Polypheny-DB server (default: 127.0.0.1).")
public static String polyphenyDbHost = "127.0.0.1";


@Option(name = { "--writeCSV" }, arity = 0, description = "Write a CSV file containing execution times for all executed queries (default: false).")
public boolean writeCsv = false;


@Option(name = { "--queryList" }, arity = 0, description = "Dump all queries into a file (default: false).")
public boolean dumpQueryList = false;


@Override
public int run() throws SQLException {

if ( args == null || args.size() < 1 ) {
System.err.println( "Missing task" );
System.exit( 1 );
}

int multiplier = 1;
if ( args.size() > 1 ) {
multiplier = Integer.parseInt( args.get( 1 ) );
if ( multiplier < 1 ) {
System.err.println( "Multiplier needs to be a integer > 0!" );
System.exit( 1 );
}
}

ExecutorFactory executorFactory;
executorFactory = new PolyphenyDbJdbcExecutorFactory( polyphenyDbHost, false );
boolean usePostgres = VectorBenchScenario.isPostgresMode();
String task = args.getFirst();

try {
if ( task.equalsIgnoreCase( "data" ) ) {
if ( usePostgres ) VectorBenchScenario.pgData( multiplier, true );
else VectorBenchScenario.data( executorFactory, multiplier, true );
} else if ( task.equalsIgnoreCase( "workload" ) ) {
if ( usePostgres ) VectorBenchScenario.pgWorkload( multiplier, true, writeCsv, dumpQueryList );
else VectorBenchScenario.workload( executorFactory, multiplier, true, writeCsv, dumpQueryList );
} else if ( args.getFirst().equalsIgnoreCase( "schema" ) ) {
if ( usePostgres ) VectorBenchScenario.pgSchema( true );
else VectorBenchScenario.schema( executorFactory, true );
} else if ( task.equalsIgnoreCase( "index" ) ) {
if ( usePostgres ) VectorBenchScenario.pgIndex( true );
else VectorBenchScenario.index( executorFactory, true );
} else if ( task.equalsIgnoreCase( "groundtruth" ) ) {
if ( usePostgres ) VectorBenchScenario.pgGroundTruth();
else VectorBenchScenario.groundTruth( executorFactory );
} else if ( task.equalsIgnoreCase( "recall" ) ) {
if ( usePostgres ) VectorBenchScenario.pgRecall();
else VectorBenchScenario.recall( executorFactory );
} else if ( args.getFirst().equalsIgnoreCase( "warmup" ) ) {
if ( usePostgres ) VectorBenchScenario.pgWarmup( multiplier, true, dumpQueryList );
else VectorBenchScenario.warmup( executorFactory, multiplier, true, dumpQueryList );
} else {
System.err.println( "Unknown task: " + args.getFirst() );
}
} catch ( Throwable t ) {
log.error( "Exception while executing VectorBench!", t );
System.exit( 1 );
}

try {
Thread.sleep( 2000 );
} catch ( InterruptedException e ) {
throw new RuntimeException( "Unexpected interrupt", e );
}

return 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public long executeQuery( Query query ) throws ExecutorException {
case ARRAY_REAL:
preparedStatement.setArray( entry.getKey(), connection.createArrayOf( "REAL", (Object[]) entry.getValue().right ) );
break;
case ARRAY_BOOLEAN:
preparedStatement.setArray( entry.getKey(), connection.createArrayOf( "BOOLEAN", (Object[]) entry.getValue().right ) );
break;
case BYTE_ARRAY:
preparedStatement.setBytes( entry.getKey(), (byte[]) entry.getValue().right );
break;
Expand Down Expand Up @@ -156,6 +159,23 @@ public long executeQuery( Query query ) throws ExecutorException {
}


/**
* Executes the given query and returns the values of the first column of the result set (e.g. the ids of a
* top-k nearest-neighbor query). Used for recall measurement where the actual returned rows are needed.
*/
public List<Long> executeQueryAndGetIds( Query query ) throws ExecutorException {
List<Long> ids = new ArrayList<>();
try ( ResultSet resultSet = executeStatement.executeQuery( query.getSql() ) ) {
while ( resultSet.next() ) {
ids.add( resultSet.getLong( 1 ) );
}
} catch ( SQLException e ) {
throw new ExecutorException( e );
}
return ids;
}


@Override
public long executeQueryAndGetNumber( Query query ) throws ExecutorException {
try {
Expand Down Expand Up @@ -254,6 +274,9 @@ protected void executeInsertListAsPreparedBatch( List<BatchableInsert> queryList
case ARRAY_REAL:
preparedStatement.setArray( entry.getKey(), connection.createArrayOf( "REAL", (Object[]) entry.getValue().right ) );
break;
case ARRAY_BOOLEAN:
preparedStatement.setArray( entry.getKey(), connection.createArrayOf( "BOOLEAN", (Object[]) entry.getValue().right) );
break;
case BYTE_ARRAY:
preparedStatement.setBytes( entry.getKey(), (byte[]) entry.getValue().right );
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,18 @@ default String deployMonetDb( boolean deployStoresUsingDocker ) throws ExecutorE


default String deployPostgres( boolean deployStoresUsingDocker ) throws ExecutorException {
return deployPostgres( deployStoresUsingDocker, "pgvector & PostGIS" );
}


default String deployPostgres( boolean deployStoresUsingDocker, String imageVariant ) throws ExecutorException {
String config;
String name;
if ( deployStoresUsingDocker ) {
name = "postgres" + storeCounter.getAndIncrement();
if ( PolyphenyVersionSwitch.getInstance().useNewAdapterDeployParameters ) {
int dockerInstanceId = getDockerInstanceId();
config = "{\"mode\":\"docker\",\"instanceId\":\"" + dockerInstanceId + "\",\"maxConnections\":\"25\"}";
config = "{\"mode\":\"docker\",\"instanceId\":\"" + dockerInstanceId + "\",\"maxConnections\":\"25\",\"imageVariant\":\"" + imageVariant + "\"}";
} else {
config = "{\"port\":\"" + nextPort.getAndIncrement() + "\",\"maxConnections\":\"25\",\"password\":\"postgres\",\"mode\":\"docker\",\"instanceId\":\"0\"}";
}
Expand Down Expand Up @@ -345,7 +350,7 @@ public PolyphenyDbInstance( PolyphenyControlConnector polyphenyControlConnector,
if ( !config.deployStoresUsingDocker ) {
PostgresInstance.reset();
}
executor.deployPostgres( config.deployStoresUsingDocker );
executor.deployPostgres( config.deployStoresUsingDocker, config.postgresImageVariant );
break;
case "monetdb":
if ( !config.deployStoresUsingDocker ) {
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/org/polypheny/simpleclient/main/ChronosAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
import org.polypheny.simpleclient.scenario.graph.GraphBenchConfig;
import org.polypheny.simpleclient.scenario.knnbench.KnnBench;
import org.polypheny.simpleclient.scenario.knnbench.KnnBenchConfig;
import org.polypheny.simpleclient.scenario.vectorbench.PgVectorBench;
import org.polypheny.simpleclient.scenario.vectorbench.VectorBench;
import org.polypheny.simpleclient.scenario.vectorbench.VectorBenchConfig;
import org.polypheny.simpleclient.scenario.multibench.MultiBench;
import org.polypheny.simpleclient.scenario.multibench.MultiBenchConfig;
import org.polypheny.simpleclient.scenario.multimedia.MultimediaBench;
Expand Down Expand Up @@ -218,7 +221,7 @@ protected Object prepare( ChronosJob chronosJob, final File inputDirectory, fina
executorFactory = new SurrealDBExecutorFactory( ChronosCommand.hostname, "8989", true );
break;
case "postgres":
dockerContainerName = DockerLauncher.launch( "postgres", "polypheny/postgres:latest", Map.of( "POSTGRES_PASSWORD", "postgres" ), List.of( 5432 ), () -> PostgresInstance.tryConnect( ChronosCommand.hostname ) );
dockerContainerName = DockerLauncher.launch( "postgres", "polypheny/postgres-pgvector-postgis:17-debian", Map.of( "POSTGRES_PASSWORD", "postgres" ), List.of( 5432 ), () -> PostgresInstance.tryConnect( ChronosCommand.hostname ) );
executorFactory = new PostgresExecutorFactory( ChronosCommand.hostname, Boolean.parseBoolean( parsedConfig.get( "prepareStatements" ) ) );
break;
case "monetdb":
Expand Down Expand Up @@ -253,6 +256,14 @@ protected Object prepare( ChronosJob chronosJob, final File inputDirectory, fina
config = new KnnBenchConfig( parsedConfig );
scenario = new KnnBench( executorFactory, (KnnBenchConfig) config, true, dumpQueryList );
break;
case "vectorBench":
config = new VectorBenchConfig( parsedConfig );
if ( config.system.equals( "postgres" ) ) {
scenario = new PgVectorBench( executorFactory, (VectorBenchConfig) config, true, dumpQueryList );
} else {
scenario = new VectorBench( executorFactory, (VectorBenchConfig) config, true, dumpQueryList );
}
break;
case "multimedia":
config = new MultimediaConfig( parsedConfig );
scenario = new MultimediaBench( executorFactory, (MultimediaConfig) config, true, dumpQueryList );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void appendToCsv( String query, long measuredTime ) {
}


private void writeLine( String[] entries ) {
private synchronized void writeLine( String[] entries ) {
try {
String line = String.join( ",", entries );
writer.write( line );
Expand Down
Loading
Loading