-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version of count points impl
- Loading branch information
Showing
6 changed files
with
113 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...search_points_collection_glove_25.run.xml → .run/qdrant_search_points_glove_25.run.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...src/main/java/io/nosqlbench/adapter/qdrant/opdispensers/QdrantCountPointsOpDispenser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.QdrantCountPointsOp; | ||
import io.nosqlbench.adapters.api.templating.ParsedOp; | ||
import io.qdrant.client.QdrantClient; | ||
import io.qdrant.client.grpc.Points.CountPoints; | ||
|
||
import java.util.function.LongFunction; | ||
|
||
public class QdrantCountPointsOpDispenser extends QdrantBaseOpDispenser<CountPoints> { | ||
public QdrantCountPointsOpDispenser(QdrantDriverAdapter adapter, ParsedOp op, LongFunction<String> targetFunction) { | ||
super(adapter, op, targetFunction); | ||
} | ||
|
||
@Override | ||
public LongFunction<CountPoints> getParamFunc( | ||
LongFunction<QdrantClient> clientF, ParsedOp op, LongFunction<String> targetF) { | ||
LongFunction<CountPoints.Builder> ebF = | ||
l -> CountPoints.newBuilder().setCollectionName(targetF.apply(l)); | ||
|
||
final LongFunction<CountPoints.Builder> lastF = ebF; | ||
return l -> lastF.apply(l).build(); | ||
} | ||
|
||
@Override | ||
public LongFunction<QdrantBaseOp<CountPoints>> createOpFunc( | ||
LongFunction<CountPoints> paramF, | ||
LongFunction<QdrantClient> clientF, | ||
ParsedOp op, | ||
LongFunction<String> targetF) { | ||
return l -> new QdrantCountPointsOp(clientF.apply(l), paramF.apply(l)); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...rs/adapter-qdrant/src/main/java/io/nosqlbench/adapter/qdrant/ops/QdrantCountPointsOp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.ops; | ||
|
||
import io.qdrant.client.QdrantClient; | ||
import io.qdrant.client.grpc.Points.CountPoints; | ||
|
||
import java.time.Duration; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
public class QdrantCountPointsOp extends QdrantBaseOp<CountPoints> { | ||
public QdrantCountPointsOp(QdrantClient client, CountPoints request) { | ||
super(client, request); | ||
} | ||
|
||
@Override | ||
public Object applyOp(long value) { | ||
long result; | ||
try { | ||
result = client.countAsync( | ||
request.getCollectionName(), | ||
request.getFilter(), | ||
request.getExact(), | ||
Duration.ofMinutes(5) // opinionated default of 5 minutes | ||
).get(); | ||
logger.info("Total vector points counted: {}", result); | ||
} catch (InterruptedException | ExecutionException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters