splits) {
+ // Raw search scans table data and should run in the coordinator with normal Paimon split
+ // planning; Spark distribution below is only for index-only evaluation.
+ if (rawSearchEnabled()) {
+ return super.read(splits);
+ }
if (splits.isEmpty()) {
return GlobalIndexResult.createEmpty();
}
diff --git a/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/read/SparkVectorSearchBuilderImpl.java b/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/read/SparkVectorSearchBuilderImpl.java
index be8d3d8cad5f..87044862582e 100644
--- a/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/read/SparkVectorSearchBuilderImpl.java
+++ b/paimon-spark/paimon-spark-common/src/main/java/org/apache/paimon/spark/read/SparkVectorSearchBuilderImpl.java
@@ -38,6 +38,7 @@ public SparkVectorSearchBuilderImpl(InnerTable table) {
@Override
public VectorRead newVectorRead() {
- return new SparkVectorReadImpl(table, filter, limit, vectorColumn, vector, options);
+ return new SparkVectorReadImpl(
+ table, partitionFilter, filter, limit, vectorColumn, vector, options);
}
}
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfFlatVectorGlobalIndexerFactory.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfFlatVectorGlobalIndexerFactory.java
index 572c7cf4edb2..12da3c121df3 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfFlatVectorGlobalIndexerFactory.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfFlatVectorGlobalIndexerFactory.java
@@ -19,7 +19,7 @@
package org.apache.paimon.vector.index;
/** Factory for the {@code ivf-flat} vector index identifier. */
-public class IvfFlatVectorGlobalIndexerFactory extends VectorGlobalIndexerFactory {
+public class IvfFlatVectorGlobalIndexerFactory extends NativeVectorGlobalIndexerFactory {
public static final String IDENTIFIER = "ivf-flat";
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswFlatVectorGlobalIndexerFactory.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswFlatVectorGlobalIndexerFactory.java
index 159e7af6f1ba..764920d5d769 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswFlatVectorGlobalIndexerFactory.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswFlatVectorGlobalIndexerFactory.java
@@ -19,7 +19,7 @@
package org.apache.paimon.vector.index;
/** Factory for the {@code ivf-hnsw-flat} vector index identifier. */
-public class IvfHnswFlatVectorGlobalIndexerFactory extends VectorGlobalIndexerFactory {
+public class IvfHnswFlatVectorGlobalIndexerFactory extends NativeVectorGlobalIndexerFactory {
public static final String IDENTIFIER = "ivf-hnsw-flat";
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswSqVectorGlobalIndexerFactory.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswSqVectorGlobalIndexerFactory.java
index 51c72cd8f39c..3f09984db5f5 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswSqVectorGlobalIndexerFactory.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfHnswSqVectorGlobalIndexerFactory.java
@@ -19,7 +19,7 @@
package org.apache.paimon.vector.index;
/** Factory for the {@code ivf-hnsw-sq} vector index identifier. */
-public class IvfHnswSqVectorGlobalIndexerFactory extends VectorGlobalIndexerFactory {
+public class IvfHnswSqVectorGlobalIndexerFactory extends NativeVectorGlobalIndexerFactory {
public static final String IDENTIFIER = "ivf-hnsw-sq";
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfPqAlgorithmVectorGlobalIndexerFactory.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfPqAlgorithmVectorGlobalIndexerFactory.java
index f3932de46ed6..f00adfcbfc3e 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfPqAlgorithmVectorGlobalIndexerFactory.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/IvfPqAlgorithmVectorGlobalIndexerFactory.java
@@ -19,7 +19,7 @@
package org.apache.paimon.vector.index;
/** Factory for the {@code ivf-pq} vector index identifier. */
-public class IvfPqAlgorithmVectorGlobalIndexerFactory extends VectorGlobalIndexerFactory {
+public class IvfPqAlgorithmVectorGlobalIndexerFactory extends NativeVectorGlobalIndexerFactory {
public static final String IDENTIFIER = "ivf-pq";
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexReader.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexReader.java
similarity index 99%
rename from paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexReader.java
rename to paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexReader.java
index cde8d2a83dd3..92f064d27089 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexReader.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexReader.java
@@ -60,7 +60,7 @@
* Each shard has exactly one vector index file. The reader lazily opens the index and performs
* vector similarity search.
*/
-public class VectorGlobalIndexReader implements GlobalIndexReader {
+public class NativeVectorGlobalIndexReader implements GlobalIndexReader {
private static final String NPROBE_PARAMETER = "ivf.nprobe";
private static final String EF_SEARCH_PARAMETER = "hnsw.ef_search";
@@ -78,7 +78,7 @@ public class VectorGlobalIndexReader implements GlobalIndexReader {
private volatile VectorIndexReader vectorReader;
private SeekableInputStream openStream;
- public VectorGlobalIndexReader(
+ public NativeVectorGlobalIndexReader(
GlobalIndexFileReader fileReader,
List ioMetas,
DataType fieldType,
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexWriter.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexWriter.java
similarity index 98%
rename from paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexWriter.java
rename to paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexWriter.java
index 0554bb78620e..fac897976eaf 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexWriter.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexWriter.java
@@ -54,11 +54,11 @@
*
* Thread safety: This class is not thread-safe.
*/
-public class VectorGlobalIndexWriter implements GlobalIndexSingleColumnWriter, Closeable {
+public class NativeVectorGlobalIndexWriter implements GlobalIndexSingleColumnWriter, Closeable {
private static final String FILE_NAME_PREFIX = "vector";
- private static final Logger LOG = LoggerFactory.getLogger(VectorGlobalIndexWriter.class);
+ private static final Logger LOG = LoggerFactory.getLogger(NativeVectorGlobalIndexWriter.class);
private static final int IO_BUFFER_SIZE = 8 * 1024 * 1024;
private static final int ADD_BATCH_SIZE = 10000;
@@ -79,7 +79,7 @@ public class VectorGlobalIndexWriter implements GlobalIndexSingleColumnWriter, C
private long rowCount;
- public VectorGlobalIndexWriter(
+ public NativeVectorGlobalIndexWriter(
GlobalIndexFileWriter fileWriter,
DataType fieldType,
Map options,
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexer.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexer.java
similarity index 76%
rename from paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexer.java
rename to paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexer.java
index a3f3bf51fb9a..cb0e8a5cd9cd 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexer.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexer.java
@@ -21,7 +21,6 @@
import org.apache.paimon.globalindex.GlobalIndexIOMeta;
import org.apache.paimon.globalindex.GlobalIndexReader;
import org.apache.paimon.globalindex.GlobalIndexWriter;
-import org.apache.paimon.globalindex.GlobalIndexer;
import org.apache.paimon.globalindex.io.GlobalIndexFileReader;
import org.apache.paimon.globalindex.io.GlobalIndexFileWriter;
import org.apache.paimon.types.DataType;
@@ -31,14 +30,16 @@
import java.util.Objects;
import java.util.concurrent.ExecutorService;
-/** Vector global indexer backed by paimon-vector-index. */
-public class VectorGlobalIndexer implements GlobalIndexer {
+/** Native vector global indexer backed by paimon-vector-index. */
+public class NativeVectorGlobalIndexer
+ implements org.apache.paimon.globalindex.VectorGlobalIndexer {
private final DataType fieldType;
private final Map options;
private final String identifier;
- public VectorGlobalIndexer(DataType fieldType, Map options, String identifier) {
+ public NativeVectorGlobalIndexer(
+ DataType fieldType, Map options, String identifier) {
this.fieldType = fieldType;
this.options = Objects.requireNonNull(options, "options must not be null");
this.identifier = Objects.requireNonNull(identifier, "identifier must not be null");
@@ -46,7 +47,7 @@ public VectorGlobalIndexer(DataType fieldType, Map options, Stri
@Override
public GlobalIndexWriter createWriter(GlobalIndexFileWriter fileWriter) {
- return new VectorGlobalIndexWriter(fileWriter, fieldType, options, identifier);
+ return new NativeVectorGlobalIndexWriter(fileWriter, fieldType, options, identifier);
}
@Override
@@ -54,6 +55,11 @@ public GlobalIndexReader createReader(
GlobalIndexFileReader fileReader,
List files,
ExecutorService executor) {
- return new VectorGlobalIndexReader(fileReader, files, fieldType, executor);
+ return new NativeVectorGlobalIndexReader(fileReader, files, fieldType, executor);
+ }
+
+ @Override
+ public String metric() {
+ return options.getOrDefault("metric", "l2");
}
}
diff --git a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexerFactory.java b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexerFactory.java
similarity index 97%
rename from paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexerFactory.java
rename to paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexerFactory.java
index 936772311478..41f09d6a7a60 100644
--- a/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/VectorGlobalIndexerFactory.java
+++ b/paimon-vector/paimon-vector-index/src/main/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexerFactory.java
@@ -29,14 +29,14 @@
import java.util.Map;
/** Factory for creating vector indexes backed by paimon-vector-index. */
-public abstract class VectorGlobalIndexerFactory implements GlobalIndexerFactory {
+public abstract class NativeVectorGlobalIndexerFactory implements GlobalIndexerFactory {
private static final int DEFAULT_DIMENSION = 128;
@Override
public GlobalIndexer create(DataField field, Options options) {
String identifier = identifier();
- return new VectorGlobalIndexer(
+ return new NativeVectorGlobalIndexer(
field.type(),
nativeOptions(field.type(), options, identifier, field.name()),
identifier);
diff --git a/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/VectorGlobalIndexTest.java b/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexTest.java
similarity index 87%
rename from paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/VectorGlobalIndexTest.java
rename to paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexTest.java
index f08c072984d7..3d83b06f773c 100644
--- a/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/VectorGlobalIndexTest.java
+++ b/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexTest.java
@@ -58,8 +58,8 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
-/** Tests for {@link VectorGlobalIndexWriter} and {@link VectorGlobalIndexReader}. */
-public class VectorGlobalIndexTest {
+/** Tests for {@link NativeVectorGlobalIndexWriter} and {@link NativeVectorGlobalIndexReader}. */
+public class NativeVectorGlobalIndexTest {
@TempDir java.nio.file.Path tempDir;
@@ -104,7 +104,7 @@ public void cleanup() throws IOException {
public void testDimensionMismatch() {
Options options = createDefaultOptions(64);
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
float[] wrongDimVector = new float[32];
assertThatThrownBy(() -> writer.write(wrongDimVector, 0))
@@ -129,7 +129,7 @@ public void testNanInVectorRejected() {
Options options = createDefaultOptions(2);
options.setInteger("ivf-pq.pq.m", 1);
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
assertThatThrownBy(() -> writer.write(new float[] {1.0f, Float.NaN}, 0))
.isInstanceOf(IllegalArgumentException.class)
@@ -143,7 +143,7 @@ public void testInfinityInVectorRejected() {
Options options = createDefaultOptions(2);
options.setInteger("ivf-pq.pq.m", 1);
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
writer.write(null, 0); // row 0 - null
assertThatThrownBy(() -> writer.write(new float[] {Float.POSITIVE_INFINITY, 0.0f}, 1))
@@ -158,7 +158,7 @@ public void testAllNullReturnsEmpty() {
Options options = createDefaultOptions(2);
options.setInteger("ivf-pq.pq.m", 1);
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
writer.write(null, 0);
writer.write(null, 1);
@@ -185,18 +185,20 @@ public void testVectorSearchParameterParsing() {
parameters.put("hnsw.ef_search", "80");
parameters.put("ignored", "bad");
- assertThat(VectorGlobalIndexReader.nprobe(parameters)).isEqualTo(24);
- assertThat(VectorGlobalIndexReader.efSearch(parameters)).isEqualTo(80);
- assertThat(VectorGlobalIndexReader.nprobe(Collections.emptyMap())).isEqualTo(16);
- assertThat(VectorGlobalIndexReader.efSearch(Collections.emptyMap())).isEqualTo(0);
+ assertThat(NativeVectorGlobalIndexReader.nprobe(parameters)).isEqualTo(24);
+ assertThat(NativeVectorGlobalIndexReader.efSearch(parameters)).isEqualTo(80);
+ assertThat(NativeVectorGlobalIndexReader.nprobe(Collections.emptyMap())).isEqualTo(16);
+ assertThat(NativeVectorGlobalIndexReader.efSearch(Collections.emptyMap())).isEqualTo(0);
}
@Test
public void testVectorSearchParameterRangeValidationDelegatedToNative() {
- assertThat(VectorGlobalIndexReader.nprobe(Collections.singletonMap("ivf.nprobe", "0")))
+ assertThat(
+ NativeVectorGlobalIndexReader.nprobe(
+ Collections.singletonMap("ivf.nprobe", "0")))
.isEqualTo(0);
assertThat(
- VectorGlobalIndexReader.efSearch(
+ NativeVectorGlobalIndexReader.efSearch(
Collections.singletonMap("hnsw.ef_search", "-1")))
.isEqualTo(-1);
}
@@ -223,7 +225,7 @@ public void testFloatVectorEndToEnd() throws IOException {
};
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
for (int i = 0; i < vectors.length; i++) {
writer.write(vectors[i], i);
}
@@ -231,8 +233,8 @@ public void testFloatVectorEndToEnd() throws IOException {
List metas = toIOMetas(results, indexPath);
GlobalIndexFileReader fileReader = createFileReader(indexPath);
- try (VectorGlobalIndexReader reader =
- new VectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
+ try (NativeVectorGlobalIndexReader reader =
+ new NativeVectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
VectorSearch vectorSearch = new VectorSearch(vectors[0], 3, fieldName);
ScoredGlobalIndexResult result = reader.visitVectorSearch(vectorSearch).join().get();
assertThat(result.results().getLongCardinality()).isEqualTo(3);
@@ -262,7 +264,7 @@ public void testSearchWithRoaringFilter() throws IOException {
};
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
for (int i = 0; i < vectors.length; i++) {
writer.write(vectors[i], i);
}
@@ -270,8 +272,8 @@ public void testSearchWithRoaringFilter() throws IOException {
List metas = toIOMetas(results, indexPath);
GlobalIndexFileReader fileReader = createFileReader(indexPath);
- try (VectorGlobalIndexReader reader =
- new VectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
+ try (NativeVectorGlobalIndexReader reader =
+ new NativeVectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
// Filter to rows {1, 4} only
RoaringNavigableMap64 filter = new RoaringNavigableMap64();
@@ -303,7 +305,7 @@ public void testNullVectorSkipWithCorrectIds() throws IOException {
};
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
writer.write(vectors[0], 0); // row 0
writer.write(null, 1); // row 1 - null
@@ -318,8 +320,8 @@ public void testNullVectorSkipWithCorrectIds() throws IOException {
List metas = toIOMetas(results, indexPath);
GlobalIndexFileReader fileReader = createFileReader(indexPath);
- try (VectorGlobalIndexReader reader =
- new VectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
+ try (NativeVectorGlobalIndexReader reader =
+ new NativeVectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
VectorSearch vectorSearch = new VectorSearch(vectors[0], 3, fieldName);
ScoredGlobalIndexResult result = reader.visitVectorSearch(vectorSearch).join().get();
assertThat(result.results().getLongCardinality()).isEqualTo(3);
@@ -348,15 +350,16 @@ public void testViaIndexer() throws IOException {
new float[] {0.7f, 0.7f}
};
- VectorGlobalIndexer indexer =
- new VectorGlobalIndexer(
+ NativeVectorGlobalIndexer indexer =
+ new NativeVectorGlobalIndexer(
vectorType,
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
vectorType, options, IVF_PQ_IDENTIFIER, fieldName),
IVF_PQ_IDENTIFIER);
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = (VectorGlobalIndexWriter) indexer.createWriter(fileWriter);
+ NativeVectorGlobalIndexWriter writer =
+ (NativeVectorGlobalIndexWriter) indexer.createWriter(fileWriter);
for (int i = 0; i < vectors.length; i++) {
writer.write(vectors[i], i);
}
@@ -364,8 +367,8 @@ public void testViaIndexer() throws IOException {
List metas = toIOMetas(results, indexPath);
GlobalIndexFileReader fileReader = createFileReader(indexPath);
- try (VectorGlobalIndexReader reader =
- (VectorGlobalIndexReader) indexer.createReader(fileReader, metas, executor)) {
+ try (NativeVectorGlobalIndexReader reader =
+ (NativeVectorGlobalIndexReader) indexer.createReader(fileReader, metas, executor)) {
VectorSearch vectorSearch = new VectorSearch(vectors[0], 2, fieldName);
ScoredGlobalIndexResult result = reader.visitVectorSearch(vectorSearch).join().get();
assertThat(result.results().getLongCardinality()).isEqualTo(2);
@@ -393,14 +396,14 @@ public void testBatchVectorSearch() throws IOException {
};
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
writeVectors(writer, vectors);
List results = writer.finish();
List metas = toIOMetas(results, indexPath);
GlobalIndexFileReader fileReader = createFileReader(indexPath);
- try (VectorGlobalIndexReader reader =
- new VectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
+ try (NativeVectorGlobalIndexReader reader =
+ new NativeVectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
float[][] queryVectors =
new float[][] {
new float[] {1.0f, 0.0f},
@@ -445,14 +448,14 @@ public void testBatchVectorSearchWithFilter() throws IOException {
};
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
writeVectors(writer, vectors);
List results = writer.finish();
List metas = toIOMetas(results, indexPath);
GlobalIndexFileReader fileReader = createFileReader(indexPath);
- try (VectorGlobalIndexReader reader =
- new VectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
+ try (NativeVectorGlobalIndexReader reader =
+ new NativeVectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
float[][] queryVectors =
new float[][] {new float[] {1.0f, 0.0f}, new float[] {-1.0f, 0.0f}};
@@ -500,14 +503,14 @@ public void testBatchConsistentWithSingle() throws IOException {
};
GlobalIndexFileWriter fileWriter = createFileWriter(indexPath);
- VectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
+ NativeVectorGlobalIndexWriter writer = createIvfPqWriter(fileWriter, vectorType, options);
writeVectors(writer, vectors);
List results = writer.finish();
List metas = toIOMetas(results, indexPath);
GlobalIndexFileReader fileReader = createFileReader(indexPath);
- try (VectorGlobalIndexReader reader =
- new VectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
+ try (NativeVectorGlobalIndexReader reader =
+ new NativeVectorGlobalIndexReader(fileReader, metas, vectorType, executor)) {
float[][] queryVectors =
new float[][] {
new float[] {1.0f, 0.0f},
@@ -541,12 +544,12 @@ public void testBatchConsistentWithSingle() throws IOException {
// =================== Helpers =====================
- private VectorGlobalIndexWriter createIvfPqWriter(
+ private NativeVectorGlobalIndexWriter createIvfPqWriter(
GlobalIndexFileWriter fileWriter, DataType fieldType, Options options) {
- return new VectorGlobalIndexWriter(
+ return new NativeVectorGlobalIndexWriter(
fileWriter,
fieldType,
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
fieldType, options, IVF_PQ_IDENTIFIER, fieldName),
IVF_PQ_IDENTIFIER);
}
@@ -558,7 +561,7 @@ private Options createDefaultOptions(int dimension) {
return options;
}
- private void writeVectors(VectorGlobalIndexWriter writer, float[][] vectors) {
+ private void writeVectors(NativeVectorGlobalIndexWriter writer, float[][] vectors) {
for (int i = 0; i < vectors.length; i++) {
writer.write(vectors[i], i);
}
diff --git a/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/VectorGlobalIndexerFactoryTest.java b/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexerFactoryTest.java
similarity index 92%
rename from paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/VectorGlobalIndexerFactoryTest.java
rename to paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexerFactoryTest.java
index b0f33d770621..92c56b648522 100644
--- a/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/VectorGlobalIndexerFactoryTest.java
+++ b/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/NativeVectorGlobalIndexerFactoryTest.java
@@ -32,7 +32,7 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
/** Tests for vector global indexer factory SPI registration. */
-public class VectorGlobalIndexerFactoryTest {
+public class NativeVectorGlobalIndexerFactoryTest {
@Test
public void testIdentifier() {
@@ -67,7 +67,7 @@ public void testNativeOptionsOnlyUsesIdentifierPrefix() {
options.setString("ivf-pq.nlist", "256");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -90,7 +90,7 @@ public void testNativeOptionsUsesVectorTypeDimension() {
options.setString("ivf-flat.dimension", "32");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new VectorType(8, new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -106,7 +106,7 @@ public void testInvalidDimension() {
assertThatThrownBy(
() ->
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -124,7 +124,7 @@ public void testFieldLevelOptionsOverrideIndexTypeOptions() {
options.setString("fields.vec.nlist", "256");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -143,7 +143,7 @@ public void testFieldLevelDimensionOverridesIndexTypeDimension() {
options.setString("fields.vec.dimension", "64");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -159,7 +159,7 @@ public void testFieldLevelOptionsOnlyApplyToMatchingField() {
options.setString("fields.vec.nlist", "256");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -175,7 +175,7 @@ public void testFieldLevelOptionsRequireExactFieldName() {
options.setString("fields.vec_extra.nlist", "512");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -190,7 +190,7 @@ public void testFieldLevelOptionsWithoutIndexTypeOption() {
options.setString("fields.vec.distance.metric", "cosine");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
@@ -207,7 +207,7 @@ public void testFieldLevelVectorOptionsCoexistWithCoreFieldOptions() {
options.setString("fields.vec.aggregate-function", "sum");
Map nativeOptions =
- VectorGlobalIndexerFactory.nativeOptions(
+ NativeVectorGlobalIndexerFactory.nativeOptions(
new ArrayType(new FloatType()),
options,
IvfFlatVectorGlobalIndexerFactory.IDENTIFIER,
diff --git a/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/SeekableStreamVectorIndexInputTest.java b/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/SeekableStreamVectorIndexInputTest.java
index ddb29eab6e97..82eeee198e7e 100644
--- a/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/SeekableStreamVectorIndexInputTest.java
+++ b/paimon-vector/paimon-vector-index/src/test/java/org/apache/paimon/vector/index/SeekableStreamVectorIndexInputTest.java
@@ -30,15 +30,15 @@
import static org.assertj.core.api.Assertions.assertThat;
-/** Tests for {@link VectorGlobalIndexReader.SeekableStreamVectorIndexInput}. */
+/** Tests for {@link NativeVectorGlobalIndexReader.SeekableStreamVectorIndexInput}. */
public class SeekableStreamVectorIndexInputTest {
@Test
public void testVectoredReadableInputUsesParallelPositionReads() throws Exception {
byte[] data = data(128 * 1024);
TestVectoredSeekableInputStream input = new TestVectoredSeekableInputStream(data, 2);
- VectorGlobalIndexReader.SeekableStreamVectorIndexInput indexInput =
- new VectorGlobalIndexReader.SeekableStreamVectorIndexInput(input);
+ NativeVectorGlobalIndexReader.SeekableStreamVectorIndexInput indexInput =
+ new NativeVectorGlobalIndexReader.SeekableStreamVectorIndexInput(input);
byte[][] buffers = new byte[][] {new byte[64], new byte[64]};
indexInput.pread(new long[] {0, 32 * 1024}, buffers);
@@ -54,8 +54,8 @@ public void testVectoredReadableInputUsesParallelPositionReads() throws Exceptio
public void testFallbackToSequentialReadWhenRangesOverlap() {
byte[] data = data(1024);
TestVectoredSeekableInputStream input = new TestVectoredSeekableInputStream(data, 0);
- VectorGlobalIndexReader.SeekableStreamVectorIndexInput indexInput =
- new VectorGlobalIndexReader.SeekableStreamVectorIndexInput(input);
+ NativeVectorGlobalIndexReader.SeekableStreamVectorIndexInput indexInput =
+ new NativeVectorGlobalIndexReader.SeekableStreamVectorIndexInput(input);
byte[][] buffers = new byte[][] {new byte[64], new byte[64]};
indexInput.pread(new long[] {0, 32}, buffers);