diff --git a/build.gradle b/build.gradle index 8375dc4..6ff4349 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ plugins { } group = 'io.qdrant' -version = '1.1.0' +version = '1.1.1' description = 'Kafka Sink Connector for Qdrant.' java.sourceCompatibility = JavaVersion.VERSION_1_8 java.targetCompatibility = JavaVersion.VERSION_1_8 diff --git a/src/main/java/io/qdrant/kafka/ValueExtractor.java b/src/main/java/io/qdrant/kafka/ValueExtractor.java index f882927..e4247c5 100644 --- a/src/main/java/io/qdrant/kafka/ValueExtractor.java +++ b/src/main/java/io/qdrant/kafka/ValueExtractor.java @@ -18,7 +18,7 @@ class ValueExtractor { private static final String COLLECTION_NAME_KEY = "collection_name"; private static final String VECTOR_KEY = "vector"; private static final String PAYLOAD_KEY = "payload"; - private static final String[] REQUIRED_FIELDS = {"collection_name", "id", "vector"}; + private static final String[] REQUIRED_FIELDS = {"collection_name", "id"}; private final Map valueMap; @@ -76,6 +76,10 @@ public Map getPayload() { public Vectors getVector() { Value vectorValue = this.valueMap.get(VECTOR_KEY); + if (vectorValue == null) { + return Vectors.getDefaultInstance(); + } + return VectorsFactory.vectors(vectorValue); } diff --git a/src/test/java/io/qdrant/kafka/ExtractorTest.java b/src/test/java/io/qdrant/kafka/ExtractorTest.java index f044625..4a47aca 100644 --- a/src/test/java/io/qdrant/kafka/ExtractorTest.java +++ b/src/test/java/io/qdrant/kafka/ExtractorTest.java @@ -122,7 +122,7 @@ void testValidateOptionsMissingField() valueMap.put("id", 12345L); ValueExtractor extractor = new ValueExtractor(valueMap); - assertThrows(DataException.class, extractor::validateOptions); + assertDoesNotThrow(extractor::validateOptions); } @Test