Skip to content

Commit e68ebe8

Browse files
committed
Add Chronos vectorbench case and helper method in JdbcExecutor
1 parent ab40958 commit e68ebe8

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

src/main/java/org/polypheny/simpleclient/executor/JdbcExecutor.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ public long executeQuery( Query query ) throws ExecutorException {
108108
case ARRAY_REAL:
109109
preparedStatement.setArray( entry.getKey(), connection.createArrayOf( "REAL", (Object[]) entry.getValue().right ) );
110110
break;
111+
case ARRAY_BOOLEAN:
112+
preparedStatement.setArray( entry.getKey(), connection.createArrayOf( "BOOLEAN", (Object[]) entry.getValue().right ) );
113+
break;
111114
case BYTE_ARRAY:
112115
preparedStatement.setBytes( entry.getKey(), (byte[]) entry.getValue().right );
113116
break;
@@ -156,6 +159,23 @@ public long executeQuery( Query query ) throws ExecutorException {
156159
}
157160

158161

162+
/**
163+
* Executes the given query and returns the values of the first column of the result set (e.g. the ids of a
164+
* top-k nearest-neighbor query). Used for recall measurement where the actual returned rows are needed.
165+
*/
166+
public List<Long> executeQueryAndGetIds( Query query ) throws ExecutorException {
167+
List<Long> ids = new ArrayList<>();
168+
try ( ResultSet resultSet = executeStatement.executeQuery( query.getSql() ) ) {
169+
while ( resultSet.next() ) {
170+
ids.add( resultSet.getLong( 1 ) );
171+
}
172+
} catch ( SQLException e ) {
173+
throw new ExecutorException( e );
174+
}
175+
return ids;
176+
}
177+
178+
159179
@Override
160180
public long executeQueryAndGetNumber( Query query ) throws ExecutorException {
161181
try {

src/main/java/org/polypheny/simpleclient/main/ChronosAgent.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
import org.polypheny.simpleclient.scenario.graph.GraphBenchConfig;
8484
import org.polypheny.simpleclient.scenario.knnbench.KnnBench;
8585
import org.polypheny.simpleclient.scenario.knnbench.KnnBenchConfig;
86+
import org.polypheny.simpleclient.scenario.vectorbench.PgVectorBench;
87+
import org.polypheny.simpleclient.scenario.vectorbench.VectorBench;
88+
import org.polypheny.simpleclient.scenario.vectorbench.VectorBenchConfig;
8689
import org.polypheny.simpleclient.scenario.multibench.MultiBench;
8790
import org.polypheny.simpleclient.scenario.multibench.MultiBenchConfig;
8891
import org.polypheny.simpleclient.scenario.multimedia.MultimediaBench;
@@ -253,6 +256,14 @@ protected Object prepare( ChronosJob chronosJob, final File inputDirectory, fina
253256
config = new KnnBenchConfig( parsedConfig );
254257
scenario = new KnnBench( executorFactory, (KnnBenchConfig) config, true, dumpQueryList );
255258
break;
259+
case "vectorBench":
260+
config = new VectorBenchConfig( parsedConfig );
261+
if ( config.system.equals( "postgres" ) ) {
262+
scenario = new PgVectorBench( executorFactory, (VectorBenchConfig) config, true, dumpQueryList );
263+
} else {
264+
scenario = new VectorBench( executorFactory, (VectorBenchConfig) config, true, dumpQueryList );
265+
}
266+
break;
256267
case "multimedia":
257268
config = new MultimediaConfig( parsedConfig );
258269
scenario = new MultimediaBench( executorFactory, (MultimediaConfig) config, true, dumpQueryList );

0 commit comments

Comments
 (0)