Skip to content

Commit

Permalink
Merge branch 'main' of github.com:nosqlbench/nosqlbench
Browse files Browse the repository at this point in the history
  • Loading branch information
jshook committed May 16, 2024
2 parents 89a6f3c + e9b4087 commit 093e5c9
Show file tree
Hide file tree
Showing 24 changed files with 1,162 additions and 33 deletions.
6 changes: 2 additions & 4 deletions mvn-defaults/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@

<PROG>nb5</PROG>
<maven.plugin.validation>VERBOSE</maven.plugin.validation>

<jacoco.version>0.8.12</jacoco.version>
</properties>

<name>${project.artifactId}</name>
Expand Down Expand Up @@ -551,7 +549,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<version>0.8.12</version>
<executions>
<execution>
<id>prepare-agent</id>
Expand Down Expand Up @@ -785,7 +783,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<version>0.8.12</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
2 changes: 1 addition & 1 deletion nb-adapters/adapter-milvus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>io.milvus</groupId>
<artifactId>milvus-sdk-java</artifactId>
<version>2.3.5</version>
<version>2.4.1</version>
</dependency>

</dependencies>
Expand Down
14 changes: 7 additions & 7 deletions nb-adapters/adapter-qdrant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<!-- <version>1.63.0</version> -->
<!-- Trying to match https://github.com/qdrant/java-client/blob/v1.9.0/build.gradle#L80 -->
<!-- If Trying to match https://github.com/qdrant/java-client/blob/v1.9.1/build.gradle#L80 -->
<version>1.59.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<!--<version>3.25.3</version>-->
<!-- Trying to match https://github.com/qdrant/java-client/blob/master/build.gradle#L81 -->
<!-- <version>3.25.3</version> -->
<!-- If Trying to match https://github.com/qdrant/java-client/blob/v1.9.1/build.gradle#L81 -->
<version>3.24.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<!--<version>33.1.0-jre</version>-->
<!-- Trying to match https://github.com/qdrant/java-client/blob/master/build.gradle#L93 -->
<version>30.1-jre</version>
<version>33.1.0-jre</version>
<!-- If Trying to match https://github.com/qdrant/java-client/blob/v1.9.1/build.gradle#L93, use below -->
<!-- <version>30.1-jre</version> -->
</dependency>
<dependency>
<groupId>io.qdrant</groupId>
<artifactId>client</artifactId>
<version>1.9.0</version>
<version>1.9.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public OpDispenser<? extends QdrantBaseOp<?>> apply(ParsedOp op) {
case search_points -> new QdrantSearchPointsOpDispenser(adapter, op, typeAndTarget.targetFunction);
case upsert_points -> new QdrantUpsertPointsOpDispenser(adapter, op, typeAndTarget.targetFunction);
case count_points -> new QdrantCountPointsOpDispenser(adapter, op, typeAndTarget.targetFunction);
case list_collections -> new QdrantListCollectionsOpDispenser(adapter, op, typeAndTarget.targetFunction);
case collection_info -> new QdrantCollectionInfoOpDispenser(adapter, op, typeAndTarget.targetFunction);
case collection_exists -> new QdrantCollectionExistsOpDispenser(adapter, op, typeAndTarget.targetFunction);
case list_collection_aliases ->
new QdrantListCollectionAliasesOpDispenser(adapter, op, typeAndTarget.targetFunction);
case list_snapshots -> new QdrantListSnapshotsOpDispenser(adapter, op, typeAndTarget.targetFunction);
// default -> throw new RuntimeException("Unrecognized op type '" + typeAndTarget.enumId.name() + "' while " +
// "mapping parsed op " + op);
};
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2020-2024 nosqlbench
*
* 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 io.nosqlbench.adapter.qdrant.opdispensers;

import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter;
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp;
import io.nosqlbench.adapter.qdrant.ops.QdrantCollectionExistsOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.grpc.Collections.CollectionExistsRequest;

import java.util.function.LongFunction;

public class QdrantCollectionExistsOpDispenser extends QdrantBaseOpDispenser<CollectionExistsRequest> {
public QdrantCollectionExistsOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, LongFunction<String> targetFunction) {
super(adapter, op, targetFunction);
}

@Override
public LongFunction<CollectionExistsRequest> getParamFunc(
LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) {
LongFunction<CollectionExistsRequest.Builder> ebF =
l -> CollectionExistsRequest.newBuilder().setCollectionName(targetF.apply(l));

final LongFunction<CollectionExistsRequest.Builder> lastF = ebF;
return l -> lastF.apply(l).build();
}

@Override
public LongFunction<QdrantBaseOp<CollectionExistsRequest>> createOpFunc(
LongFunction<CollectionExistsRequest> paramF,
LongFunction<QdrantClient> clientF,
ParsedOp op,
LongFunction<String> targetF) {
return l -> new QdrantCollectionExistsOp(clientF.apply(l), paramF.apply(l));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2020-2024 nosqlbench
*
* 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 io.nosqlbench.adapter.qdrant.opdispensers;

import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter;
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp;
import io.nosqlbench.adapter.qdrant.ops.QdrantCollectionInfoOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.qdrant.client.QdrantClient;

import java.util.function.LongFunction;

public class QdrantCollectionInfoOpDispenser extends QdrantBaseOpDispenser<String> {
public QdrantCollectionInfoOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, LongFunction<String> targetFunction) {
super(adapter, op, targetFunction);
}

@Override
public LongFunction<String> getParamFunc(
LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) {
return l -> targetF.apply(l);
}

@Override
public LongFunction<QdrantBaseOp<String>> createOpFunc(
LongFunction<String> paramF,
LongFunction<QdrantClient> clientF,
ParsedOp op,
LongFunction<String> targetF) {
return l -> new QdrantCollectionInfoOp(clientF.apply(l), paramF.apply(l));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.grpc.Points.CountPoints;
import io.qdrant.client.grpc.Points.Filter;

import java.util.function.LongFunction;

Expand All @@ -36,6 +37,14 @@ public LongFunction<CountPoints> getParamFunc(
LongFunction<CountPoints.Builder> ebF =
l -> CountPoints.newBuilder().setCollectionName(targetF.apply(l));

ebF = op.enhanceFuncOptionally(ebF, "exact", Boolean.class, CountPoints.Builder::setExact);

LongFunction<Filter.Builder> filterBuilder = getFilterFromOp(op);
if (filterBuilder != null) {
final LongFunction<CountPoints.Builder> filterF = ebF;
ebF = l -> filterF.apply(l).setFilter(filterBuilder.apply(l));
}

final LongFunction<CountPoints.Builder> lastF = ebF;
return l -> lastF.apply(l).build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@

import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter;
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp;
import io.nosqlbench.adapter.qdrant.ops.QdrantPayloadIndexOp;
import io.nosqlbench.adapter.qdrant.ops.QdrantCreatePayloadIndexOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.grpc.Collections.PayloadIndexParams;
import io.qdrant.client.grpc.Points.CreateFieldIndexCollection;
import io.qdrant.client.grpc.Points.FieldType;
import io.qdrant.client.grpc.Points.WriteOrdering;
import io.qdrant.client.grpc.Points.WriteOrderingType;

import java.util.Optional;
import java.util.function.LongFunction;

public class QdrantCreatePayloadIndexOpDispenser extends QdrantBaseOpDispenser<PayloadIndexParams> {
public class QdrantCreatePayloadIndexOpDispenser extends QdrantBaseOpDispenser<CreateFieldIndexCollection> {
public QdrantCreatePayloadIndexOpDispenser(
QdrantDriverAdapter adapter,
ParsedOp op,
Expand All @@ -34,21 +38,44 @@ public QdrantCreatePayloadIndexOpDispenser(
}

@Override
public LongFunction<PayloadIndexParams> getParamFunc(
public LongFunction<CreateFieldIndexCollection> getParamFunc(
LongFunction<QdrantClient> clientF,
ParsedOp op,
LongFunction<String> targetF) {
LongFunction<PayloadIndexParams.Builder> ebF =
l -> PayloadIndexParams.newBuilder().setField(null, targetF.apply(l));
return l -> ebF.apply(l).build();
LongFunction<CreateFieldIndexCollection.Builder> ebF =
l -> CreateFieldIndexCollection.newBuilder().setCollectionName(targetF.apply(l));
// https://github.com/qdrant/java-client/blob/v1.9.1/src/main/java/io/qdrant/client/QdrantClient.java#L2240-L2248

ebF = op.enhanceFuncOptionally(ebF, "field_name", String.class, CreateFieldIndexCollection.Builder::setFieldName);

LongFunction<String> fieldTypeF = op.getAsRequiredFunction("field_type", String.class);
final LongFunction<CreateFieldIndexCollection.Builder> ftF = ebF;
ebF = l -> ftF.apply(l).setFieldType(FieldType.valueOf(fieldTypeF.apply(l)));

Optional<LongFunction<String>> writeOrderingF = op.getAsOptionalFunction("ordering", String.class);
if (writeOrderingF.isPresent()) {
LongFunction<CreateFieldIndexCollection.Builder> woF = ebF;
LongFunction<WriteOrdering> writeOrdrF = buildWriteOrderingFunc(writeOrderingF.get());
ebF = l -> woF.apply(l).setOrdering(writeOrdrF.apply(l));
}
ebF = op.enhanceFuncOptionally(ebF, "wait", Boolean.class, CreateFieldIndexCollection.Builder::setWait);

final LongFunction<CreateFieldIndexCollection.Builder> lastF = ebF;
return l -> lastF.apply(l).build();
}

@Override
public LongFunction<QdrantBaseOp<PayloadIndexParams>> createOpFunc(
LongFunction<PayloadIndexParams> paramF,
public LongFunction<QdrantBaseOp<CreateFieldIndexCollection>> createOpFunc(
LongFunction<CreateFieldIndexCollection> paramF,
LongFunction<QdrantClient> clientF,
ParsedOp op,
LongFunction<String> targetF) {
return l -> new QdrantPayloadIndexOp(clientF.apply(l), paramF.apply(l));
return l -> new QdrantCreatePayloadIndexOp(clientF.apply(l), paramF.apply(l));
}

private LongFunction<WriteOrdering> buildWriteOrderingFunc(LongFunction<String> stringLongFunction) {
return l -> {
return WriteOrdering.newBuilder().setType(WriteOrderingType.valueOf(stringLongFunction.apply(l))).build();
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2020-2024 nosqlbench
*
* 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 io.nosqlbench.adapter.qdrant.opdispensers;

import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter;
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp;
import io.nosqlbench.adapter.qdrant.ops.QdrantListCollectionAliasesOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.qdrant.client.QdrantClient;
import io.qdrant.client.grpc.Collections.ListCollectionAliasesRequest;

import java.util.function.LongFunction;

public class QdrantListCollectionAliasesOpDispenser extends QdrantBaseOpDispenser<ListCollectionAliasesRequest> {
public QdrantListCollectionAliasesOpDispenser(QdrantDriverAdapter adapter, ParsedOp op,
LongFunction<String> targetFunction) {
super(adapter, op, targetFunction);
}

@Override
public LongFunction<ListCollectionAliasesRequest> getParamFunc(LongFunction<QdrantClient> clientF, ParsedOp op,
LongFunction<String> targetF) {
LongFunction<ListCollectionAliasesRequest.Builder> ebF =
l -> ListCollectionAliasesRequest.newBuilder().setCollectionName(targetF.apply(l));

final LongFunction<ListCollectionAliasesRequest.Builder> lastF = ebF;
return l -> lastF.apply(l).build();
}

@Override
public LongFunction<QdrantBaseOp<ListCollectionAliasesRequest>> createOpFunc(
LongFunction<ListCollectionAliasesRequest> paramF,
LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) {
return l -> new QdrantListCollectionAliasesOp(clientF.apply(l), paramF.apply(l));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2020-2024 nosqlbench
*
* 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 io.nosqlbench.adapter.qdrant.opdispensers;

import io.nosqlbench.adapter.qdrant.QdrantDriverAdapter;
import io.nosqlbench.adapter.qdrant.ops.QdrantBaseOp;
import io.nosqlbench.adapter.qdrant.ops.QdrantListCollectionsOp;
import io.nosqlbench.adapters.api.templating.ParsedOp;
import io.qdrant.client.QdrantClient;

import java.util.function.LongFunction;

public class QdrantListCollectionsOpDispenser extends QdrantBaseOpDispenser<Object> {
public QdrantListCollectionsOpDispenser(QdrantDriverAdapter adapter,
ParsedOp op, LongFunction<String> targetFunction) {
super(adapter, op, targetFunction);
}

@Override
public LongFunction<Object> getParamFunc(LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) {
return l -> "";
}

@Override
public LongFunction<QdrantBaseOp<Object>> createOpFunc(
LongFunction<Object> paramF,
LongFunction<QdrantClient> clientF,
ParsedOp op, LongFunction<String> targetF) {
return l -> new QdrantListCollectionsOp(clientF.apply(l), null);
}
}
Loading

0 comments on commit 093e5c9

Please sign in to comment.