Skip to content

Commit

Permalink
chore: removed redundant javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush008 committed Mar 22, 2024
1 parent 1b36106 commit 449004f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 37 deletions.
6 changes: 1 addition & 5 deletions src/main/java/io/qdrant/spark/Qdrant.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
import org.apache.spark.sql.types.StructType;
import org.apache.spark.sql.util.CaseInsensitiveStringMap;

/**
* A class that implements the TableProvider and DataSourceRegister interfaces. Provides methods to
* A class that implements the TableProvider and DataSourceRegister interfaces. Provides methods to
* infer schema, get table, and check required options.
*/
/** A class that implements the TableProvider and DataSourceRegister interfaces. */
public class Qdrant implements TableProvider, DataSourceRegister {

private final String[] requiredFields = new String[] {"schema", "collection_name", "qdrant_url"};
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/io/qdrant/spark/QdrantBatchWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
import org.apache.spark.sql.connector.write.WriterCommitMessage;
import org.apache.spark.sql.types.StructType;

/**
* QdrantBatchWriter class implements the BatchWrite interface and provides a factory for creating
* QdrantDataWriterFactory instances. It also provides methods for committing or aborting write
* operations.
*/
/** QdrantBatchWriter class implements the BatchWrite interface. */
public class QdrantBatchWriter implements BatchWrite {

private final QdrantOptions options;
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/io/qdrant/spark/QdrantCluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
import org.apache.spark.sql.connector.write.WriteBuilder;
import org.apache.spark.sql.types.StructType;

/**
* QdrantCluster class implements the SupportsWrite interface and provides a newWriteBuilder method
* to write data to Qdrant. It also provides methods to get the name, schema and capabilities of the
* QdrantCluster.
*/
/** QdrantCluster class implements the SupportsWrite interface. */
public class QdrantCluster implements SupportsWrite {

private final StructType schema;
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/io/qdrant/spark/QdrantDataWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* A DataWriter implementation that writes data to Qdrant, a vector search engine. This class takes
* QdrantOptions and StructType as input and writes data to QdrantGRPC. It implements the DataWriter
* interface and overrides its methods write, commit, abort and close. It also has a private method
* write that is used to upload a batch of points to Qdrant. The class uses a Point class to
* represent a data point and an ArrayList to store the points.
*/
/** A DataWriter implementation that writes data to Qdrant. */
public class QdrantDataWriter implements DataWriter<InternalRow>, Serializable {
private final QdrantOptions options;
private final StructType schema;
Expand Down
27 changes: 12 additions & 15 deletions src/main/java/io/qdrant/spark/QdrantGrpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
import io.qdrant.client.grpc.Points.PointStruct;
import io.qdrant.client.grpc.Points.ShardKeySelector;
import io.qdrant.client.grpc.Points.UpsertPoints;

import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.concurrent.ExecutionException;

import javax.annotation.Nullable;

/** A class that provides methods to interact with Qdrant REST API. */
/** A class that provides methods to interact with Qdrant GRPC API. */
public class QdrantGrpc implements Serializable {
private final QdrantClient client;

/**
* Constructor for QdrantRest class.
*
* @param url The URL of the Qdrant instance.
* @param url The URL of the Qdrant instance.
* @param apiKey The API key to authenticate with Qdrant.
* @throws MalformedURLException If the URL is invalid.
*/
Expand All @@ -31,27 +29,26 @@ public QdrantGrpc(URL url, String apiKey) throws MalformedURLException {
int port = url.getPort() == -1 ? 6334 : url.getPort();
boolean useTls = url.getProtocol().equalsIgnoreCase("https");

this.client = new QdrantClient(
QdrantGrpcClient.newBuilder(host, port, useTls).withApiKey(apiKey).build());
this.client =
new QdrantClient(
QdrantGrpcClient.newBuilder(host, port, useTls).withApiKey(apiKey).build());
}

/**
* Uploads a batch of points to a Qdrant collection.
*
* @param collectionName The name of the collection to upload the points to.
* @param points The list of points to upload.
* @param points The list of points to upload.
* @param shardKeySelector The shard key selector to use for the upsert.
*
* @throws InterruptedException If there was an error uploading the batch to
* Qdrant.
* @throws ExecutionException If there was an error uploading the batch to
* Qdrant.
* @throws InterruptedException If there was an error uploading the batch to Qdrant.
* @throws ExecutionException If there was an error uploading the batch to Qdrant.
*/
public void upsert(String collectionName, List<PointStruct> points, @Nullable ShardKeySelector shardKeySelector)
public void upsert(
String collectionName, List<PointStruct> points, @Nullable ShardKeySelector shardKeySelector)
throws InterruptedException, ExecutionException {

UpsertPoints.Builder upsertPoints = UpsertPoints.newBuilder().setCollectionName(collectionName)
.addAllPoints(points);
UpsertPoints.Builder upsertPoints =
UpsertPoints.newBuilder().setCollectionName(collectionName).addAllPoints(points);

if (shardKeySelector != null) {
upsertPoints.setShardKeySelector(shardKeySelector);
Expand Down

0 comments on commit 449004f

Please sign in to comment.