This is an automated email from the ASF dual-hosted git repository.

JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new fc53a83e36 [core] Support bounded parallel builds for primary-key 
indexes (#10756)
fc53a83e36 is described below

commit fc53a83e36f5877fc85e012efc590cf08359cc61
Author: tzphh <[email protected]>
AuthorDate: Sat Nov 7 00:01:59 2026 +0800

    [core] Support bounded parallel builds for primary-key indexes (#10756)
---
 docs/docs/primary-key-table/global-index.mdx       |  39 ++
 docs/generated/core_configuration.html             |   6 +
 .../main/java/org/apache/paimon/CoreOptions.java   |  20 +
 .../testvector/TestVectorGlobalIndexerFactory.java |   6 +
 .../pk/BucketedPrimaryKeyIndexMaintainer.java      | 230 ++++++-----
 .../pkvector/BucketedVectorIndexMaintainer.java    |  12 +
 .../paimon/operation/AbstractFileStoreWrite.java   |   3 +-
 .../org/apache/paimon/schema/SchemaValidation.java |   2 +
 .../org/apache/paimon/GlobalIndexOptionsTest.java  |  15 +
 .../pk/BucketedPrimaryKeyIndexMaintainerTest.java  | 424 +++++++++++++++++++--
 .../index/pk/PrimaryKeyIndexDefinitionsTest.java   |  59 +++
 .../PrimaryKeySortedIndexMaintenanceTest.java      |  22 +-
 .../BucketedVectorIndexMaintainerTest.java         |  29 +-
 .../pkvector/PrimaryKeyVectorIndexOptionsTest.java |  23 +-
 .../paimon/operation/PrimaryKeyIndexWriteTest.java |  24 +-
 .../operation/PrimaryKeyVectorIndexWriteTest.java  |  95 ++++-
 .../table/source/PrimaryKeyVectorSearchTest.java   | 214 +++++++++++
 .../procedure/VectorSearchProcedureITCase.java     |  83 ++++
 .../spark/sql/PrimaryKeyVectorSearchTest.scala     |  70 +++-
 19 files changed, 1179 insertions(+), 197 deletions(-)

diff --git a/docs/docs/primary-key-table/global-index.mdx 
b/docs/docs/primary-key-table/global-index.mdx
index 1de4b8ca0c..ff8fdcc73a 100644
--- a/docs/docs/primary-key-table/global-index.mdx
+++ b/docs/docs/primary-key-table/global-index.mdx
@@ -261,10 +261,37 @@ TBLPROPERTIES (
 
 </details>
 
+### Index Multiple Vector Columns
+
+List the vector columns in `global-index.<type>.index-columns` and configure 
field overrides
+with `fields.<column>.index-options`. For example, this Flink table indexes 
image and text
+embeddings independently:
+
+```sql
+CREATE TABLE multimodal_items (
+    id BIGINT,
+    image_embedding ARRAY<FLOAT> COMMENT '__VECTOR_FIELD;512',
+    text_embedding ARRAY<FLOAT> COMMENT '__VECTOR_FIELD;768',
+    PRIMARY KEY (id) NOT ENFORCED
+) WITH (
+    'bucket' = '8',
+    'deletion-vectors.enabled' = 'true',
+    'global-index.ivf-flat.index-columns' = 'image_embedding,text_embedding',
+    'fields.image_embedding.index-options' = 
'{"nlist":256,"distance.metric":"cosine"}',
+    'fields.text_embedding.index-options' = 
'{"nlist":512,"distance.metric":"inner_product"}'
+);
+```
+
+Each vector search selects one column and uses that column's index, dimension, 
and distance
+metric. Listing multiple columns does not combine their vectors or define a 
fused ranking.
+Index coverage is tracked separately for each column, so an index on 
`image_embedding` does
+not cover a query on `text_embedding`. VECTOR columns outside the index list 
remain unindexed.
+
 ### Options
 
 | Option | Default | Description |
 |---|---|---|
+| `pk-index.build.parallelism` | `1` | Maximum concurrent primary-key index 
build tasks per writer instance. Must be positive. |
 | `global-index.<type>.index-columns` | Not set | Comma-separated columns, 
each owning an independent index. Types include `btree`, `bitmap`, 
`multivalue`, `fm`, `full-text`, and actual ANN implementations such as 
`ivf-flat`, `ivf-pq`, `ivf-sq`, `ivf-rq`, or `diskann`. |
 | `fields.<column>.index-options` | Not set | JSON object of field overrides. 
Short keys are scoped to the selected implementation; for example, 
`{"nlist":64,"distance.metric":"cosine"}` for IVF-PQ. |
 | `<type>.dimension` | Implementation default | Vector dimension for the 
selected ANN implementation. A fixed-length `VECTOR` column also carries its 
dimension in the schema. |
@@ -301,6 +328,18 @@ in the [`paimon-full-text` 
README](https://github.com/apache/paimon/blob/master/
 
 ## Maintenance and Coverage
 
+Set `pk-index.build.parallelism` to `2`, for example, to allow two primary-key 
index build tasks
+to run concurrently within one writer instance. The default is `1`. Vector, 
Full Text, BTree,
+Bitmap, Multivalue, and FM indexes share this limit across that writer's 
columns and buckets.
+It is not the Flink or Spark job parallelism.
+
+Blocking commits start all configured indexes before waiting for their 
results. Non-blocking
+commits start builds and collect finished results without waiting; outstanding 
builds are
+collected by later commits. If an index fails during preparation, the 
coordinator rolls back
+that preparation, cancels outstanding builds, and cleans up uncommitted 
outputs. Previously
+committed snapshots remain valid. More concurrent builds can increase memory 
and I/O usage;
+each index implementation may also use its own internal threads.
+
 Paimon builds primary-key indexes from complete `COMPACT` data files above 
Level 0. An index group
 stores the source file names and row counts required to map index results back 
to physical rows.
 Data-file and index-file changes are committed in the same snapshot.
diff --git a/docs/generated/core_configuration.html 
b/docs/generated/core_configuration.html
index bbeed02c58..fd07f8d85e 100644
--- a/docs/generated/core_configuration.html
+++ b/docs/generated/core_configuration.html
@@ -1434,6 +1434,12 @@ For an internal format table in a REST catalog, it also 
makes the catalog own th
             <td>Boolean</td>
             <td>Enables clustering by non-primary key fields. When set to 
true, the physical sort order of data files is determined by the configured 
'clustering.columns' instead of the primary key, optimizing query performance 
for non-PK columns.</td>
         </tr>
+        <tr>
+            <td><h5>pk-index.build.parallelism</h5></td>
+            <td style="word-wrap: break-word;">1</td>
+            <td>Integer</td>
+            <td>The maximum number of concurrent primary-key index build tasks 
per writer instance, shared by its index columns and buckets. Must be greater 
than zero. Increasing this value may increase memory and I/O usage.</td>
+        </tr>
         <tr>
             <td><h5>postpone.batch-write-fixed-bucket</h5></td>
             <td style="word-wrap: break-word;">true</td>
diff --git a/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java 
b/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
index 4de6ea06a4..110154abad 100644
--- a/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
+++ b/paimon-api/src/main/java/org/apache/paimon/CoreOptions.java
@@ -3244,6 +3244,16 @@ public class CoreOptions implements Serializable {
                             "The batch size for lateral vector search. Each 
batch executes vector "
                                     + "topK search and table lookup for 
multiple query vectors.");
 
+    public static final ConfigOption<Integer> PK_INDEX_BUILD_PARALLELISM =
+            key("pk-index.build.parallelism")
+                    .intType()
+                    .defaultValue(1)
+                    .withDescription(
+                            "The maximum number of concurrent primary-key 
index build tasks per "
+                                    + "writer instance, shared by its index 
columns and buckets. "
+                                    + "Must be greater than zero. Increasing 
this value may increase "
+                                    + "memory and I/O usage.");
+
     public static final ConfigOption<String> GLOBAL_INDEX_BTREE_INDEX_COLUMNS =
             key("global-index.btree.index-columns")
                     .stringType()
@@ -5072,6 +5082,16 @@ public class CoreOptions implements Serializable {
         return options.get(VECTOR_SEARCH_LATERAL_JOIN_BATCH_SIZE);
     }
 
+    public int primaryKeyIndexBuildParallelism() {
+        int parallelism = options.get(PK_INDEX_BUILD_PARALLELISM);
+        checkArgument(
+                parallelism > 0,
+                "%s must be greater than zero, but is %s.",
+                PK_INDEX_BUILD_PARALLELISM.key(),
+                parallelism);
+        return parallelism;
+    }
+
     public boolean fullTextIndexEnabled() {
         return !fullTextIndexColumns().isEmpty();
     }
diff --git 
a/paimon-common/src/test/java/org/apache/paimon/globalindex/testvector/TestVectorGlobalIndexerFactory.java
 
b/paimon-common/src/test/java/org/apache/paimon/globalindex/testvector/TestVectorGlobalIndexerFactory.java
index e87a8eec32..7bad6d9f29 100644
--- 
a/paimon-common/src/test/java/org/apache/paimon/globalindex/testvector/TestVectorGlobalIndexerFactory.java
+++ 
b/paimon-common/src/test/java/org/apache/paimon/globalindex/testvector/TestVectorGlobalIndexerFactory.java
@@ -40,6 +40,12 @@ public class TestVectorGlobalIndexerFactory implements 
GlobalIndexerFactory {
 
     @Override
     public GlobalIndexer create(List<DataField> indexFields, Options options) {
+        String metric = options.getString(IDENTIFIER + ".metric", null);
+        // Existing test fixtures may explicitly select their metric with the 
test-only option.
+        if (metric != null && options.get(TestVectorGlobalIndexer.OPT_METRIC) 
== null) {
+            options = new Options(options.toMap());
+            options.setString(TestVectorGlobalIndexer.OPT_METRIC, metric);
+        }
         if (indexFields.size() == 1) {
             return new TestVectorGlobalIndexer(indexFields.get(0).type(), 
options);
         }
diff --git 
a/paimon-core/src/main/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainer.java
 
b/paimon-core/src/main/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainer.java
index 0c2167e8b0..2096b37ee4 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainer.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainer.java
@@ -41,6 +41,8 @@ import org.apache.paimon.io.KeyValueFileReaderFactory;
 import org.apache.paimon.options.VectorIndexOptions;
 import org.apache.paimon.schema.TableSchema;
 import org.apache.paimon.types.DataField;
+import org.apache.paimon.utils.ExceptionUtils;
+import org.apache.paimon.utils.IOUtils;
 
 import javax.annotation.Nullable;
 
@@ -50,22 +52,22 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ExecutorService;
+import java.util.function.Consumer;
 
 import static org.apache.paimon.utils.Preconditions.checkArgument;
 
 /** Coordinates all source-backed primary-key indexes for one bucket. */
 public final class BucketedPrimaryKeyIndexMaintainer {
 
-    @Nullable private final BucketedVectorIndexMaintainer vectorMaintainer;
+    private final List<BucketedVectorIndexMaintainer> vectorMaintainers;
     @Nullable private final BucketedFullTextIndexMaintainer fullTextMaintainer;
     private final List<BucketedSortedIndexMaintainer> sortedMaintainers;
-    private int nextSortedMaintainerIndex;
 
     private BucketedPrimaryKeyIndexMaintainer(
-            @Nullable BucketedVectorIndexMaintainer vectorMaintainer,
+            List<BucketedVectorIndexMaintainer> vectorMaintainers,
             @Nullable BucketedFullTextIndexMaintainer fullTextMaintainer,
             List<BucketedSortedIndexMaintainer> sortedMaintainers) {
-        this.vectorMaintainer = vectorMaintainer;
+        this.vectorMaintainers = Collections.unmodifiableList(new 
ArrayList<>(vectorMaintainers));
         this.fullTextMaintainer = fullTextMaintainer;
         List<BucketedSortedIndexMaintainer> sorted = new 
ArrayList<>(sortedMaintainers);
         
sorted.sort(Comparator.comparingInt(BucketedSortedIndexMaintainer::fieldId));
@@ -75,19 +77,19 @@ public final class BucketedPrimaryKeyIndexMaintainer {
     public static BucketedPrimaryKeyIndexMaintainer ofVector(
             BucketedVectorIndexMaintainer vectorMaintainer) {
         return new BucketedPrimaryKeyIndexMaintainer(
-                vectorMaintainer, null, Collections.emptyList());
+                Collections.singletonList(vectorMaintainer), null, 
Collections.emptyList());
     }
 
     public static BucketedPrimaryKeyIndexMaintainer ofFullText(
             BucketedFullTextIndexMaintainer fullTextMaintainer) {
         return new BucketedPrimaryKeyIndexMaintainer(
-                null, fullTextMaintainer, Collections.emptyList());
+                Collections.emptyList(), fullTextMaintainer, 
Collections.emptyList());
     }
 
     public static BucketedPrimaryKeyIndexMaintainer of(
             BucketedVectorIndexMaintainer vectorMaintainer,
             List<BucketedSortedIndexMaintainer> sortedMaintainers) {
-        return new BucketedPrimaryKeyIndexMaintainer(vectorMaintainer, null, 
sortedMaintainers);
+        return of(vectorMaintainer, null, sortedMaintainers);
     }
 
     public static BucketedPrimaryKeyIndexMaintainer of(
@@ -95,12 +97,25 @@ public final class BucketedPrimaryKeyIndexMaintainer {
             @Nullable BucketedFullTextIndexMaintainer fullTextMaintainer,
             List<BucketedSortedIndexMaintainer> sortedMaintainers) {
         return new BucketedPrimaryKeyIndexMaintainer(
-                vectorMaintainer, fullTextMaintainer, sortedMaintainers);
+                vectorMaintainer == null
+                        ? Collections.emptyList()
+                        : Collections.singletonList(vectorMaintainer),
+                fullTextMaintainer,
+                sortedMaintainers);
+    }
+
+    public static BucketedPrimaryKeyIndexMaintainer ofVectors(
+            List<BucketedVectorIndexMaintainer> vectorMaintainers,
+            @Nullable BucketedFullTextIndexMaintainer fullTextMaintainer,
+            List<BucketedSortedIndexMaintainer> sortedMaintainers) {
+        return new BucketedPrimaryKeyIndexMaintainer(
+                vectorMaintainers, fullTextMaintainer, sortedMaintainers);
     }
 
     public static BucketedPrimaryKeyIndexMaintainer ofSorted(
             List<BucketedSortedIndexMaintainer> sortedMaintainers) {
-        return new BucketedPrimaryKeyIndexMaintainer(null, null, 
sortedMaintainers);
+        return new BucketedPrimaryKeyIndexMaintainer(
+                Collections.emptyList(), null, sortedMaintainers);
     }
 
     public synchronized void prepareCommit(
@@ -108,45 +123,25 @@ public final class BucketedPrimaryKeyIndexMaintainer {
             CompactIncrement compactIncrement,
             boolean waitCompaction)
             throws Exception {
-        BucketedVectorIndexMaintainer.VectorIndexCommit vectorCommit = null;
-        BucketedFullTextIndexMaintainer.FullTextIndexCommit fullTextCommit = 
null;
-        List<BucketedSortedIndexMaintainer.SortedIndexCommit> sortedCommits = 
new ArrayList<>();
+        List<Runnable> commits = new ArrayList<>();
+        List<Consumer<Throwable>> aborts = new ArrayList<>();
         try {
-            if (vectorMaintainer != null) {
-                vectorCommit =
-                        vectorMaintainer.prepareCommit(
-                                appendIncrement, compactIncrement, 
waitCompaction);
-            }
-            if (fullTextMaintainer != null) {
-                fullTextCommit =
-                        fullTextMaintainer.prepareCommit(
-                                appendIncrement, compactIncrement, 
waitCompaction);
-            }
-
-            if (waitCompaction) {
-                prepareSortedBlocking(appendIncrement, compactIncrement, 
sortedCommits);
-            } else {
-                prepareSortedNonBlocking(appendIncrement, compactIncrement, 
sortedCommits);
-            }
-
-            if (vectorCommit != null) {
-                mergeVectorCommit(appendIncrement, compactIncrement, 
vectorCommit);
+            // Start all indexes before waiting. Retain both rounds for 
reverse-order rollback,
+            // and merge changes only after every index has prepared 
successfully.
+            int indexCount =
+                    vectorMaintainers.size()
+                            + sortedMaintainers.size()
+                            + (fullTextMaintainer == null ? 0 : 1);
+            if (waitCompaction && indexCount > 1) {
+                prepareIndexes(appendIncrement, compactIncrement, false, 
commits, aborts);
             }
-            if (fullTextCommit != null) {
-                mergeFullTextCommit(appendIncrement, compactIncrement, 
fullTextCommit);
-            }
-            for (BucketedSortedIndexMaintainer.SortedIndexCommit sortedCommit 
: sortedCommits) {
-                mergeSortedCommit(appendIncrement, compactIncrement, 
sortedCommit);
+            prepareIndexes(appendIncrement, compactIncrement, waitCompaction, 
commits, aborts);
+            for (Runnable commit : commits) {
+                commit.run();
             }
         } catch (Throwable failure) {
-            for (int i = sortedCommits.size() - 1; i >= 0; i--) {
-                sortedCommits.get(i).abort(failure);
-            }
-            if (fullTextCommit != null) {
-                fullTextCommit.abort(failure);
-            }
-            if (vectorCommit != null) {
-                vectorCommit.abort(failure);
+            for (int i = aborts.size() - 1; i >= 0; i--) {
+                aborts.get(i).accept(failure);
             }
             if (failure instanceof Exception) {
                 throw (Exception) failure;
@@ -158,58 +153,32 @@ public final class BucketedPrimaryKeyIndexMaintainer {
         }
     }
 
-    private void prepareSortedBlocking(
-            DataIncrement appendIncrement,
-            CompactIncrement compactIncrement,
-            List<BucketedSortedIndexMaintainer.SortedIndexCommit> commits)
-            throws Exception {
-        BucketedSortedIndexMaintainer active = activeSortedMaintainer();
-        for (BucketedSortedIndexMaintainer maintainer : sortedMaintainers) {
-            commits.add(
-                    maintainer.prepareCommit(
-                            appendIncrement, compactIncrement, true, 
maintainer == active));
-        }
-        for (BucketedSortedIndexMaintainer maintainer : sortedMaintainers) {
-            if (maintainer != active) {
-                commits.add(
-                        maintainer.prepareCommit(appendIncrement, 
compactIncrement, true, true));
-            }
-        }
-    }
-
-    private void prepareSortedNonBlocking(
+    private void prepareIndexes(
             DataIncrement appendIncrement,
             CompactIncrement compactIncrement,
-            List<BucketedSortedIndexMaintainer.SortedIndexCommit> commits)
+            boolean waitCompaction,
+            List<Runnable> commits,
+            List<Consumer<Throwable>> aborts)
             throws Exception {
-        for (BucketedSortedIndexMaintainer maintainer : sortedMaintainers) {
-            commits.add(maintainer.prepareCommit(appendIncrement, 
compactIncrement, false, false));
-        }
-        if (activeSortedMaintainer() != null) {
-            return;
+        for (BucketedVectorIndexMaintainer maintainer : vectorMaintainers) {
+            BucketedVectorIndexMaintainer.VectorIndexCommit commit =
+                    maintainer.prepareCommit(appendIncrement, 
compactIncrement, waitCompaction);
+            aborts.add(commit::abort);
+            commits.add(() -> mergeVectorCommit(appendIncrement, 
compactIncrement, commit));
         }
-
-        int count = sortedMaintainers.size();
-        for (int offset = 0; offset < count; offset++) {
-            int index = (nextSortedMaintainerIndex + offset) % count;
-            BucketedSortedIndexMaintainer maintainer = 
sortedMaintainers.get(index);
-            if (maintainer.hasPendingMaintenance()) {
-                commits.add(
-                        maintainer.prepareCommit(appendIncrement, 
compactIncrement, false, true));
-                nextSortedMaintainerIndex = (index + 1) % count;
-                break;
-            }
+        if (fullTextMaintainer != null) {
+            BucketedFullTextIndexMaintainer.FullTextIndexCommit commit =
+                    fullTextMaintainer.prepareCommit(
+                            appendIncrement, compactIncrement, waitCompaction);
+            aborts.add(commit::abort);
+            commits.add(() -> mergeFullTextCommit(appendIncrement, 
compactIncrement, commit));
         }
-    }
-
-    @Nullable
-    private BucketedSortedIndexMaintainer activeSortedMaintainer() {
         for (BucketedSortedIndexMaintainer maintainer : sortedMaintainers) {
-            if (maintainer.buildNotCompleted()) {
-                return maintainer;
-            }
+            BucketedSortedIndexMaintainer.SortedIndexCommit commit =
+                    maintainer.prepareCommit(appendIncrement, 
compactIncrement, waitCompaction);
+            aborts.add(commit::abort);
+            commits.add(() -> mergeSortedCommit(appendIncrement, 
compactIncrement, commit));
         }
-        return null;
     }
 
     private static void mergeSortedCommit(
@@ -288,18 +257,28 @@ public final class BucketedPrimaryKeyIndexMaintainer {
     }
 
     public boolean buildNotCompleted() {
-        if (vectorMaintainer != null && vectorMaintainer.buildNotCompleted()) {
-            return true;
+        for (BucketedVectorIndexMaintainer maintainer : vectorMaintainers) {
+            if (maintainer.buildNotCompleted()) {
+                return true;
+            }
         }
         if (fullTextMaintainer != null && 
fullTextMaintainer.buildNotCompleted()) {
             return true;
         }
-        return activeSortedMaintainer() != null;
+        for (BucketedSortedIndexMaintainer maintainer : sortedMaintainers) {
+            if (maintainer.buildNotCompleted()) {
+                return true;
+            }
+        }
+        return false;
     }
 
     public void withExecutor(ExecutorService executor) {
-        if (vectorMaintainer != null) {
-            vectorMaintainer.withExecutor(executor);
+        checkArgument(
+                !buildNotCompleted(),
+                "Cannot replace executor during primary-key index 
maintenance.");
+        for (BucketedVectorIndexMaintainer maintainer : vectorMaintainers) {
+            maintainer.withExecutor(executor);
         }
         if (fullTextMaintainer != null) {
             fullTextMaintainer.withExecutor(executor);
@@ -310,14 +289,20 @@ public final class BucketedPrimaryKeyIndexMaintainer {
     }
 
     public void close() {
-        if (vectorMaintainer != null) {
-            vectorMaintainer.close();
+        List<AutoCloseable> closeables = new ArrayList<>();
+        for (BucketedVectorIndexMaintainer maintainer : vectorMaintainers) {
+            closeables.add(maintainer::close);
         }
         if (fullTextMaintainer != null) {
-            fullTextMaintainer.close();
+            closeables.add(fullTextMaintainer::close);
         }
         for (BucketedSortedIndexMaintainer maintainer : sortedMaintainers) {
-            maintainer.close();
+            closeables.add(maintainer::close);
+        }
+        try {
+            IOUtils.closeAll(closeables);
+        } catch (Exception e) {
+            ExceptionUtils.rethrow(e);
         }
     }
 
@@ -325,24 +310,27 @@ public final class BucketedPrimaryKeyIndexMaintainer {
     public static final class Factory {
 
         private final IndexFileHandler handler;
-        @Nullable private final BucketedVectorIndexMaintainer.Factory 
vectorFactory;
+        private final List<BucketedVectorIndexMaintainer.Factory> 
vectorFactories;
         @Nullable private final FullTextDefinitionFactory fullTextFactory;
         private final List<SortedDefinitionFactory> sortedFactories;
 
         private Factory(
                 IndexFileHandler handler,
-                @Nullable BucketedVectorIndexMaintainer.Factory vectorFactory,
+                List<BucketedVectorIndexMaintainer.Factory> vectorFactories,
                 @Nullable FullTextDefinitionFactory fullTextFactory,
                 List<SortedDefinitionFactory> sortedFactories) {
             this.handler = handler;
-            this.vectorFactory = vectorFactory;
+            this.vectorFactories = Collections.unmodifiableList(new 
ArrayList<>(vectorFactories));
             this.fullTextFactory = fullTextFactory;
             this.sortedFactories = Collections.unmodifiableList(new 
ArrayList<>(sortedFactories));
         }
 
         public static Factory ofVector(BucketedVectorIndexMaintainer.Factory 
vectorFactory) {
             return new Factory(
-                    vectorFactory.indexFileHandler(), vectorFactory, null, 
Collections.emptyList());
+                    vectorFactory.indexFileHandler(),
+                    Collections.singletonList(vectorFactory),
+                    null,
+                    Collections.emptyList());
         }
 
         public static Factory create(
@@ -351,7 +339,7 @@ public final class BucketedPrimaryKeyIndexMaintainer {
                 TableSchema schema) {
             CoreOptions coreOptions = new CoreOptions(schema.options());
             Map<String, DataField> fields = schema.nameToFieldMap();
-            BucketedVectorIndexMaintainer.Factory vectorFactory = null;
+            List<BucketedVectorIndexMaintainer.Factory> vectorFactories = new 
ArrayList<>();
             FullTextDefinitionFactory fullTextFactory = null;
             List<SortedDefinitionFactory> sortedFactories = new ArrayList<>();
             for (PrimaryKeyIndexDefinition definition :
@@ -363,10 +351,7 @@ public final class BucketedPrimaryKeyIndexMaintainer {
                         definition.column());
                 switch (definition.family()) {
                     case VECTOR:
-                        checkArgument(
-                                vectorFactory == null,
-                                "Only one primary-key vector index is 
supported.");
-                        vectorFactory =
+                        vectorFactories.add(
                                 new BucketedVectorIndexMaintainer.Factory(
                                                 handler,
                                                 readerFactoryBuilder,
@@ -377,7 +362,7 @@ public final class BucketedPrimaryKeyIndexMaintainer {
                                                                 
definition.column())
                                                         .metric(),
                                                 definition.indexType())
-                                        
.withIndexOptions(definition.options());
+                                        
.withIndexOptions(definition.options()));
                         break;
                     case BTREE:
                     case BITMAP:
@@ -413,9 +398,11 @@ public final class BucketedPrimaryKeyIndexMaintainer {
                 }
             }
             checkArgument(
-                    vectorFactory != null || fullTextFactory != null || 
!sortedFactories.isEmpty(),
+                    !vectorFactories.isEmpty()
+                            || fullTextFactory != null
+                            || !sortedFactories.isEmpty(),
                     "No primary-key index definition is configured.");
-            return new Factory(handler, vectorFactory, fullTextFactory, 
sortedFactories);
+            return new Factory(handler, vectorFactories, fullTextFactory, 
sortedFactories);
         }
 
         public IndexFileHandler indexFileHandler() {
@@ -460,16 +447,17 @@ public final class BucketedPrimaryKeyIndexMaintainer {
                     restoredDataFiles == null ? Collections.emptyList() : 
restoredDataFiles;
             List<IndexFileMeta> payloads =
                     restoredPayloads == null ? Collections.emptyList() : 
restoredPayloads;
-            BucketedVectorIndexMaintainer vector =
-                    vectorFactory == null
-                            ? null
-                            : vectorFactory.create(
-                                    partition,
-                                    bucket,
-                                    dataFiles,
-                                    payloads,
-                                    executor,
-                                    deletionVectorFactory);
+            List<BucketedVectorIndexMaintainer> vectors = new ArrayList<>();
+            for (BucketedVectorIndexMaintainer.Factory factory : 
vectorFactories) {
+                vectors.add(
+                        factory.create(
+                                partition,
+                                bucket,
+                                dataFiles,
+                                payloads,
+                                executor,
+                                deletionVectorFactory));
+            }
             BucketedFullTextIndexMaintainer fullText =
                     fullTextFactory == null
                             ? null
@@ -482,7 +470,7 @@ public final class BucketedPrimaryKeyIndexMaintainer {
                                 handler, partition, bucket, dataFiles, 
payloads, executor,
                                 ioManager));
             }
-            return new BucketedPrimaryKeyIndexMaintainer(vector, fullText, 
sorted);
+            return new BucketedPrimaryKeyIndexMaintainer(vectors, fullText, 
sorted);
         }
 
         private static final class FullTextDefinitionFactory {
diff --git 
a/paimon-core/src/main/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainer.java
 
b/paimon-core/src/main/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainer.java
index b923e052b9..85ad6dea12 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainer.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainer.java
@@ -183,6 +183,18 @@ public class BucketedVectorIndexMaintainer {
             activeSourceFiles.clear();
             activeSourceFiles.putAll(nextSources);
 
+            // A source transition retires its old coverage before starting 
replacement builds.
+            // Non-blocking preparation can then publish the data transition 
without stale indexes.
+            removeSegments(
+                    PkVectorBucketIndexState.fromActiveDataFiles(
+                                    vectorFieldId,
+                                    algorithm,
+                                    new 
ArrayList<>(activeSourceFiles.values()),
+                                    annSegments)
+                            .staleSegments(),
+                    created,
+                    removed);
+
             while (true) {
                 Optional<CompletedBuild> completed = 
finishPendingBuild(waitCompaction);
                 if (completed.isPresent()) {
diff --git 
a/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreWrite.java
 
b/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreWrite.java
index ba9b4223e9..96c8feb75e 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreWrite.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/operation/AbstractFileStoreWrite.java
@@ -718,7 +718,8 @@ public abstract class AbstractFileStoreWrite<T> implements 
FileStoreWrite<T> {
     private ExecutorService primaryKeyIndexExecutor() {
         if (lazyPrimaryKeyIndexExecutor == null) {
             lazyPrimaryKeyIndexExecutor =
-                    Executors.newSingleThreadExecutor(
+                    Executors.newFixedThreadPool(
+                            options.primaryKeyIndexBuildParallelism(),
                             new ExecutorThreadFactory(
                                     Thread.currentThread().getName() + 
"-primary-key-index"));
         }
diff --git 
a/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java 
b/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java
index e10122c718..9e43600543 100644
--- a/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java
+++ b/paimon-core/src/main/java/org/apache/paimon/schema/SchemaValidation.java
@@ -407,6 +407,8 @@ public class SchemaValidation {
                 fieldNamesSpecifiedAsVector.isEmpty(),
                 "Some of the columns specified as vector-field are unknown.");
 
+        options.primaryKeyIndexBuildParallelism();
+
         validateMergeFunctionFactory(schema);
 
         validateMapStorageLayout(schema, options);
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/GlobalIndexOptionsTest.java 
b/paimon-core/src/test/java/org/apache/paimon/GlobalIndexOptionsTest.java
index b909074e37..cf9acfff78 100644
--- a/paimon-core/src/test/java/org/apache/paimon/GlobalIndexOptionsTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/GlobalIndexOptionsTest.java
@@ -47,6 +47,21 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 /** Configuration contracts shared by primary-key and Data Evolution indexes. 
*/
 class GlobalIndexOptionsTest {
 
+    @ParameterizedTest
+    @CsvSource({"0,ivf-pq", "-1,ivf-pq", "0,btree", "-1,btree"})
+    void testRejectsNonPositivePrimaryKeyIndexBuildParallelism(int 
parallelism, String type) {
+        Map<String, String> values = new HashMap<>();
+        values.put("bucket", "1");
+        values.put("deletion-vectors.enabled", "true");
+        values.put(
+                "global-index." + type + ".index-columns",
+                "btree".equals(type) ? "amount" : "embedding");
+        values.put(CoreOptions.PK_INDEX_BUILD_PARALLELISM.key(), 
String.valueOf(parallelism));
+
+        assertThatThrownBy(() -> 
SchemaValidation.validateTableSchema(schema(values, true)))
+                .hasMessageContaining("pk-index.build.parallelism must be 
greater than zero");
+    }
+
     @ParameterizedTest
     @ValueSource(
             strings = {
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainerTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainerTest.java
index 91db135a0d..d4df19ce1d 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainerTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/index/pk/BucketedPrimaryKeyIndexMaintainerTest.java
@@ -27,15 +27,18 @@ import org.apache.paimon.index.IndexFileHandler;
 import org.apache.paimon.index.IndexFileMeta;
 import org.apache.paimon.index.IndexPathFactory;
 import org.apache.paimon.index.pkfulltext.BucketedFullTextIndexMaintainer;
+import org.apache.paimon.index.pkfulltext.PkFullTextIndexBuilder;
 import org.apache.paimon.index.pkfulltext.PkFullTextIndexFile;
 import org.apache.paimon.index.pksorted.BucketedSortedIndexMaintainer;
 import org.apache.paimon.index.pksorted.PkSortedIndexFile;
 import org.apache.paimon.index.pkvector.BucketedVectorIndexMaintainer;
+import org.apache.paimon.index.pkvector.PkVectorAnnSegmentFile;
 import org.apache.paimon.io.CompactIncrement;
 import org.apache.paimon.io.DataFileMeta;
 import org.apache.paimon.io.DataIncrement;
 import org.apache.paimon.io.KeyValueFileReaderFactory;
 import org.apache.paimon.manifest.FileSource;
+import org.apache.paimon.options.Options;
 import org.apache.paimon.schema.TableSchema;
 import org.apache.paimon.stats.SimpleStats;
 import org.apache.paimon.types.DataField;
@@ -44,6 +47,10 @@ import org.apache.paimon.types.DataTypes;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+import org.junit.jupiter.params.provider.ValueSource;
+import org.mockito.InOrder;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -56,6 +63,7 @@ import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
@@ -64,8 +72,12 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Answers.RETURNS_SELF;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
 import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -82,18 +94,297 @@ class BucketedPrimaryKeyIndexMaintainerTest {
 
     @Test
     void testDelegatesVectorLifecycle() {
-        BucketedVectorIndexMaintainer vector = 
mock(BucketedVectorIndexMaintainer.class);
+        BucketedVectorIndexMaintainer first = 
mock(BucketedVectorIndexMaintainer.class);
+        BucketedVectorIndexMaintainer second = 
mock(BucketedVectorIndexMaintainer.class);
         ExecutorService executor = mock(ExecutorService.class);
-        when(vector.buildNotCompleted()).thenReturn(true);
+        when(second.buildNotCompleted()).thenReturn(true);
         BucketedPrimaryKeyIndexMaintainer maintainer =
-                BucketedPrimaryKeyIndexMaintainer.ofVector(vector);
+                BucketedPrimaryKeyIndexMaintainer.ofVectors(
+                        Arrays.asList(first, second), null, 
Collections.emptyList());
 
         assertThat(maintainer.buildNotCompleted()).isTrue();
+        assertThatThrownBy(() -> maintainer.withExecutor(executor))
+                .hasMessageContaining("Cannot replace executor");
+        verify(first, never()).withExecutor(any());
+        verify(second, never()).withExecutor(any());
+
+        when(second.buildNotCompleted()).thenReturn(false);
+        assertThat(maintainer.buildNotCompleted()).isFalse();
         maintainer.withExecutor(executor);
         maintainer.close();
 
-        verify(vector).withExecutor(executor);
-        verify(vector).close();
+        verify(first).withExecutor(executor);
+        verify(second).withExecutor(executor);
+        verify(first).close();
+        verify(second).close();
+    }
+
+    @Test
+    void testClosesAllIndexesWhenVectorCloseFails() {
+        BucketedVectorIndexMaintainer first = 
mock(BucketedVectorIndexMaintainer.class);
+        BucketedVectorIndexMaintainer second = 
mock(BucketedVectorIndexMaintainer.class);
+        RuntimeException failure = new RuntimeException("first close failed");
+        RuntimeException suppressed = new RuntimeException("second close 
failed");
+        doThrow(failure).when(first).close();
+        doThrow(suppressed).when(second).close();
+        BucketedFullTextIndexMaintainer fullText = 
mock(BucketedFullTextIndexMaintainer.class);
+        BucketedSortedIndexMaintainer sorted = 
mock(BucketedSortedIndexMaintainer.class);
+        BucketedPrimaryKeyIndexMaintainer maintainer =
+                BucketedPrimaryKeyIndexMaintainer.ofVectors(
+                        Arrays.asList(first, second), fullText, 
Collections.singletonList(sorted));
+
+        
assertThatThrownBy(maintainer::close).isSameAs(failure).hasSuppressedException(suppressed);
+        verify(second).close();
+        verify(fullText).close();
+        verify(sorted).close();
+    }
+
+    @Test
+    void testVectorFailureRollsBackEarlierIndexAndAllowsRetry() throws 
Exception {
+        DataFileMeta source = dataFile("data-1", 3);
+        IndexFileMeta firstPayload = payload("first", source, 3, 2, "vector");
+        IndexFileMeta secondPayload = payload("second", source, 3, 1, 
"vector");
+        PkVectorAnnSegmentFile firstFile = mock(PkVectorAnnSegmentFile.class);
+        PkVectorAnnSegmentFile secondFile = mock(PkVectorAnnSegmentFile.class);
+        when(firstFile.build(anyList(), any(), any(), eq("l2"), eq("vector")))
+                .thenReturn(firstPayload);
+        when(secondFile.build(anyList(), any(), any(), eq("l2"), eq("vector")))
+                .thenThrow(new IllegalStateException("second vector failed"))
+                .thenReturn(secondPayload);
+        BucketedVectorIndexMaintainer first = vectorMaintainer(2, firstFile);
+        BucketedVectorIndexMaintainer second = vectorMaintainer(1, secondFile);
+        BucketedPrimaryKeyIndexMaintainer maintainer =
+                BucketedPrimaryKeyIndexMaintainer.ofVectors(
+                        Arrays.asList(first, second), null, 
Collections.emptyList());
+        DataIncrement append = DataIncrement.emptyIncrement();
+        CompactIncrement failed = compactAfter(source);
+
+        assertThatThrownBy(() -> maintainer.prepareCommit(append, failed, 
true))
+                .hasMessage("second vector failed");
+        assertThat(append.newIndexFiles()).isEmpty();
+        assertThat(append.deletedIndexFiles()).isEmpty();
+        assertThat(failed.newIndexFiles()).isEmpty();
+        assertThat(failed.deletedIndexFiles()).isEmpty();
+        assertThat(first.segments()).isEmpty();
+        assertThat(second.segments()).isEmpty();
+        assertThat(maintainer.buildNotCompleted()).isFalse();
+        verify(firstFile).delete(firstPayload);
+
+        CompactIncrement retry = compactAfter(source);
+        maintainer.prepareCommit(DataIncrement.emptyIncrement(), retry, true);
+
+        assertThat(retry.newIndexFiles()).containsExactly(firstPayload, 
secondPayload);
+        assertThat(first.segments()).containsExactly(firstPayload);
+        assertThat(second.segments()).containsExactly(secondPayload);
+        maintainer.close();
+    }
+
+    @ParameterizedTest
+    @CsvSource({"false,1", "false,2", "true,1", "true,2"})
+    void testIndexBuildsOverlapWithinExecutorLimit(boolean waitCompaction, int 
parallelism)
+            throws Exception {
+        DataFileMeta source = dataFile("data-1", 3);
+        CountDownLatch started = new CountDownLatch(parallelism);
+        CountDownLatch release = new CountDownLatch(1);
+        AtomicInteger active = new AtomicInteger();
+        AtomicInteger peak = new AtomicInteger();
+        List<IndexFileMeta> payloads = new ArrayList<>();
+        IndexFileMeta vectorPayload = payload("vector", source, 3, 1, 
"vector");
+        payloads.add(vectorPayload);
+        PkVectorAnnSegmentFile vectorFile = mock(PkVectorAnnSegmentFile.class);
+        when(vectorFile.build(anyList(), any(), any(), eq("l2"), eq("vector")))
+                .thenAnswer(ignored -> blockedBuild(vectorPayload, active, 
peak, started, release));
+        IndexFileMeta textPayload = payload("text", source, 3, 2, "full-text");
+        payloads.add(textPayload);
+        PkFullTextIndexBuilder textBuilder = 
mock(PkFullTextIndexBuilder.class);
+        when(textBuilder.build(any(DataFileMeta.class)))
+                .thenAnswer(ignored -> blockedBuild(textPayload, active, peak, 
started, release));
+        BucketedFullTextIndexMaintainer fullText = 
fullTextMaintainer(textBuilder);
+        List<BucketedSortedIndexMaintainer> sorted = new ArrayList<>();
+        for (String type : Arrays.asList("btree", "bitmap", "multivalue", 
"fm")) {
+            int fieldId = sorted.size() + 3;
+            IndexFileMeta result = payload(type, source, 3, fieldId, type);
+            payloads.add(result);
+            sorted.add(
+                    sortedMaintainer(
+                            fieldId,
+                            type,
+                            source,
+                            files -> blockedBuild(result, active, peak, 
started, release)));
+        }
+        BucketedPrimaryKeyIndexMaintainer maintainer =
+                BucketedPrimaryKeyIndexMaintainer.of(
+                        vectorMaintainer(1, vectorFile), fullText, sorted);
+        ExecutorService executor = Executors.newFixedThreadPool(parallelism);
+        maintainer.withExecutor(executor);
+        CompactIncrement compact = compactAfter(source);
+        ExecutorService committer = Executors.newSingleThreadExecutor();
+        try {
+            Future<?> commit =
+                    committer.submit(
+                            () -> {
+                                maintainer.prepareCommit(
+                                        DataIncrement.emptyIncrement(), 
compact, waitCompaction);
+                                return null;
+                            });
+            assertThat(started.await(5, TimeUnit.SECONDS)).isTrue();
+            assertThat(active).hasValue(parallelism);
+            if (waitCompaction) {
+                assertThat(commit.isDone()).isFalse();
+            } else {
+                commit.get(5, TimeUnit.SECONDS);
+                assertThat(compact.newIndexFiles()).isEmpty();
+                assertThat(maintainer.buildNotCompleted()).isTrue();
+            }
+            release.countDown();
+            commit.get(5, TimeUnit.SECONDS);
+            if (!waitCompaction) {
+                maintainer.prepareCommit(DataIncrement.emptyIncrement(), 
compact, true);
+            }
+            assertThat(peak).hasValue(parallelism);
+            
assertThat(compact.newIndexFiles()).containsExactlyInAnyOrderElementsOf(payloads);
+            assertThat(maintainer.buildNotCompleted()).isFalse();
+        } finally {
+            release.countDown();
+            committer.shutdownNow();
+            assertThat(committer.awaitTermination(5, 
TimeUnit.SECONDS)).isTrue();
+            maintainer.close();
+            executor.shutdownNow();
+        }
+    }
+
+    @ParameterizedTest
+    @ValueSource(booleans = {false, true})
+    void 
testFirstVectorFailureCancelsAnotherRunningBuildAndAllowsRetry(boolean 
useFullText)
+            throws Exception {
+        DataFileMeta source = dataFile("data-1", 3);
+        IndexFileMeta firstPayload = payload("first", source, 3, 1, "vector");
+        IndexFileMeta secondPayload =
+                payload("second", source, 3, 2, useFullText ? "full-text" : 
"vector");
+        CountDownLatch secondStarted = new CountDownLatch(1);
+        CountDownLatch secondStopped = new CountDownLatch(1);
+        CountDownLatch release = new CountDownLatch(1);
+        PkVectorAnnSegmentFile firstFile = mock(PkVectorAnnSegmentFile.class);
+        PkVectorAnnSegmentFile secondFile = mock(PkVectorAnnSegmentFile.class);
+        when(firstFile.build(anyList(), any(), any(), eq("l2"), eq("vector")))
+                .thenAnswer(
+                        ignored -> {
+                            assertThat(secondStarted.await(5, 
TimeUnit.SECONDS)).isTrue();
+                            throw new IllegalStateException("first vector 
failed");
+                        })
+                .thenReturn(firstPayload);
+        when(secondFile.build(anyList(), any(), any(), eq("l2"), eq("vector")))
+                .thenAnswer(
+                        ignored -> {
+                            secondStarted.countDown();
+                            try {
+                                assertThat(release.await(10, 
TimeUnit.SECONDS)).isTrue();
+                                return secondPayload;
+                            } finally {
+                                secondStopped.countDown();
+                            }
+                        })
+                .thenReturn(secondPayload);
+        BucketedVectorIndexMaintainer first = vectorMaintainer(1, firstFile);
+        BucketedVectorIndexMaintainer second = vectorMaintainer(2, secondFile);
+        PkFullTextIndexBuilder textBuilder = 
mock(PkFullTextIndexBuilder.class);
+        when(textBuilder.build(source))
+                .thenAnswer(
+                        ignored -> {
+                            secondStarted.countDown();
+                            try {
+                                assertThat(release.await(10, 
TimeUnit.SECONDS)).isTrue();
+                                return secondPayload;
+                            } finally {
+                                secondStopped.countDown();
+                            }
+                        })
+                .thenReturn(secondPayload);
+        BucketedFullTextIndexMaintainer fullText = 
fullTextMaintainer(textBuilder);
+        BucketedPrimaryKeyIndexMaintainer maintainer =
+                useFullText
+                        ? BucketedPrimaryKeyIndexMaintainer.of(
+                                first, fullText, Collections.emptyList())
+                        : BucketedPrimaryKeyIndexMaintainer.ofVectors(
+                                Arrays.asList(first, second), null, 
Collections.emptyList());
+        CompactIncrement failed = compactAfter(source);
+        try {
+            assertThatThrownBy(
+                            () ->
+                                    maintainer.prepareCommit(
+                                            DataIncrement.emptyIncrement(), 
failed, true))
+                    .hasMessage("first vector failed");
+            assertThat(secondStopped.await(5, TimeUnit.SECONDS)).isTrue();
+            assertThat(failed.newIndexFiles()).isEmpty();
+            assertThat(failed.deletedIndexFiles()).isEmpty();
+            assertThat(first.segments()).isEmpty();
+            assertThat(second.segments()).isEmpty();
+            assertThat(fullText.payloads()).isEmpty();
+            assertThat(maintainer.buildNotCompleted()).isFalse();
+
+            CompactIncrement retry = compactAfter(source);
+            maintainer.prepareCommit(DataIncrement.emptyIncrement(), retry, 
true);
+            assertThat(retry.newIndexFiles()).containsExactly(firstPayload, 
secondPayload);
+        } finally {
+            release.countDown();
+            maintainer.close();
+        }
+    }
+
+    @Test
+    void testFullTextFailureAbortsAllPreparedVectorsInReverseOrder() throws 
Exception {
+        BucketedVectorIndexMaintainer first = 
mock(BucketedVectorIndexMaintainer.class);
+        BucketedVectorIndexMaintainer second = 
mock(BucketedVectorIndexMaintainer.class);
+        BucketedVectorIndexMaintainer.VectorIndexCommit firstCommit =
+                mock(BucketedVectorIndexMaintainer.VectorIndexCommit.class);
+        BucketedVectorIndexMaintainer.VectorIndexCommit secondCommit =
+                mock(BucketedVectorIndexMaintainer.VectorIndexCommit.class);
+        BucketedVectorIndexMaintainer.VectorIndexCommit firstStarted =
+                mock(BucketedVectorIndexMaintainer.VectorIndexCommit.class);
+        BucketedVectorIndexMaintainer.VectorIndexCommit secondStarted =
+                mock(BucketedVectorIndexMaintainer.VectorIndexCommit.class);
+        when(first.prepareCommit(any(), any(), 
eq(false))).thenReturn(firstStarted);
+        when(second.prepareCommit(any(), any(), 
eq(false))).thenReturn(secondStarted);
+        when(first.prepareCommit(any(), any(), 
eq(true))).thenReturn(firstCommit);
+        when(second.prepareCommit(any(), any(), 
eq(true))).thenReturn(secondCommit);
+        BucketedFullTextIndexMaintainer fullText = 
mock(BucketedFullTextIndexMaintainer.class);
+        BucketedFullTextIndexMaintainer.FullTextIndexCommit textStarted =
+                
mock(BucketedFullTextIndexMaintainer.FullTextIndexCommit.class);
+        when(fullText.prepareCommit(any(), any(), 
eq(false))).thenReturn(textStarted);
+        IllegalStateException failure = new IllegalStateException("full-text 
failed");
+        when(fullText.prepareCommit(any(), any(), 
eq(true))).thenThrow(failure);
+        BucketedPrimaryKeyIndexMaintainer maintainer =
+                BucketedPrimaryKeyIndexMaintainer.ofVectors(
+                        Arrays.asList(first, second), fullText, 
Collections.emptyList());
+        DataIncrement append = DataIncrement.emptyIncrement();
+        CompactIncrement compact = CompactIncrement.emptyIncrement();
+
+        assertThatThrownBy(() -> maintainer.prepareCommit(append, compact, 
true)).isSameAs(failure);
+        InOrder order =
+                inOrder(
+                        first,
+                        second,
+                        fullText,
+                        firstCommit,
+                        secondCommit,
+                        firstStarted,
+                        secondStarted,
+                        textStarted);
+        order.verify(first).prepareCommit(append, compact, false);
+        order.verify(second).prepareCommit(append, compact, false);
+        order.verify(fullText).prepareCommit(append, compact, false);
+        order.verify(first).prepareCommit(append, compact, true);
+        order.verify(second).prepareCommit(append, compact, true);
+        order.verify(fullText).prepareCommit(append, compact, true);
+        order.verify(secondCommit).abort(failure);
+        order.verify(firstCommit).abort(failure);
+        order.verify(textStarted).abort(failure);
+        order.verify(secondStarted).abort(failure);
+        order.verify(firstStarted).abort(failure);
+        verify(firstCommit, never()).appendIncrement();
+        verify(secondCommit, never()).appendIncrement();
+        assertThat(append.newIndexFiles()).isEmpty();
+        assertThat(compact.newIndexFiles()).isEmpty();
     }
 
     @Test
@@ -119,6 +410,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
 
         assertThat(compactIncrement.newIndexFiles()).containsExactly(payload);
         assertThat(maintainer.buildNotCompleted()).isTrue();
+        when(fullText.buildNotCompleted()).thenReturn(false);
         maintainer.withExecutor(buildExecutor);
         maintainer.close();
         verify(fullText).withExecutor(buildExecutor);
@@ -168,6 +460,8 @@ class BucketedPrimaryKeyIndexMaintainerTest {
         BucketedFullTextIndexMaintainer fullText = 
mock(BucketedFullTextIndexMaintainer.class);
         BucketedFullTextIndexMaintainer.FullTextIndexCommit fullTextCommit =
                 
mock(BucketedFullTextIndexMaintainer.FullTextIndexCommit.class);
+        when(fullText.prepareCommit(any(), any(), eq(false)))
+                
.thenReturn(mock(BucketedFullTextIndexMaintainer.FullTextIndexCommit.class));
         when(fullText.prepareCommit(any(), any(), 
eq(true))).thenReturn(fullTextCommit);
         when(fullTextCommit.appendIncrement()).thenReturn(Optional.empty());
         when(fullTextCommit.compactIncrement()).thenReturn(Optional.empty());
@@ -202,6 +496,8 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                 mock(BucketedVectorIndexMaintainer.VectorIndexCommit.class);
         BucketedVectorIndexMaintainer.VectorIndexIncrement vectorIncrement =
                 mock(BucketedVectorIndexMaintainer.VectorIndexIncrement.class);
+        when(vector.prepareCommit(any(), any(), eq(false)))
+                
.thenReturn(mock(BucketedVectorIndexMaintainer.VectorIndexCommit.class));
         when(vector.prepareCommit(any(), any(), 
eq(true))).thenReturn(vectorCommit);
         when(vectorCommit.appendIncrement()).thenReturn(Optional.empty());
         
when(vectorCommit.compactIncrement()).thenReturn(Optional.of(vectorIncrement));
@@ -209,6 +505,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
         
when(vectorIncrement.deletedIndexFiles()).thenReturn(Collections.emptyList());
 
         List<String> buildOrder = Collections.synchronizedList(new 
ArrayList<>());
+        CountDownLatch bitmapStarted = new CountDownLatch(1);
         BucketedSortedIndexMaintainer btree =
                 sortedMaintainer(
                         7,
@@ -216,6 +513,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                         source,
                         dataFile -> {
                             buildOrder.add("btree");
+                            assertThat(bitmapStarted.await(5, 
TimeUnit.SECONDS)).isTrue();
                             throw new IllegalStateException("expected BTree 
failure");
                         });
         IndexFileMeta bitmapPayload = payload("bitmap", source, 3, 8, 
"bitmap");
@@ -226,6 +524,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                         source,
                         dataFile -> {
                             buildOrder.add("bitmap");
+                            bitmapStarted.countDown();
                             return bitmapPayload;
                         });
         BucketedPrimaryKeyIndexMaintainer maintainer =
@@ -239,7 +538,9 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                 .isInstanceOf(IllegalStateException.class)
                 .hasMessage("expected BTree failure");
 
-        assertThat(buildOrder).containsExactly("btree", "btree", "btree");
+        assertThat(buildOrder).containsExactlyInAnyOrder("btree", "btree", 
"btree", "bitmap");
+        assertThat(btree.state().groups()).isEmpty();
+        assertThat(bitmap.state().groups()).isEmpty();
         assertThat(compactIncrement.newIndexFiles()).isEmpty();
         assertThat(compactIncrement.deletedIndexFiles()).isEmpty();
         assertThat(maintainer.buildNotCompleted()).isFalse();
@@ -247,7 +548,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
     }
 
     @Test
-    void testScalarDefinitionsNeverBuildConcurrently() throws Exception {
+    void testScalarDefinitionsBuildConcurrently() throws Exception {
         DataFileMeta source = dataFile("data-1", 3);
         AtomicInteger activeBuilds = new AtomicInteger();
         AtomicInteger peakBuilds = new AtomicInteger();
@@ -272,6 +573,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                         "bitmap",
                         source,
                         dataFile -> {
+                            assertThat(firstStarted.await(5, 
TimeUnit.SECONDS)).isTrue();
                             enterBuild(activeBuilds, peakBuilds);
                             secondStarted.countDown();
                             activeBuilds.decrementAndGet();
@@ -282,21 +584,14 @@ class BucketedPrimaryKeyIndexMaintainerTest {
 
         maintainer.prepareCommit(DataIncrement.emptyIncrement(), 
compactAfter(source), false);
         assertThat(firstStarted.await(5, TimeUnit.SECONDS)).isTrue();
-        assertThat(secondStarted.getCount()).isEqualTo(1);
+        assertThat(secondStarted.await(5, TimeUnit.SECONDS)).isTrue();
         assertThat(maintainer.buildNotCompleted()).isTrue();
 
         releaseFirst.countDown();
-        long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(5);
-        while (secondStarted.getCount() > 0 && System.nanoTime() < deadline) {
-            maintainer.prepareCommit(
-                    DataIncrement.emptyIncrement(), 
CompactIncrement.emptyIncrement(), false);
-            secondStarted.await(10, TimeUnit.MILLISECONDS);
-        }
-        assertThat(secondStarted.getCount()).isZero();
         maintainer.prepareCommit(
                 DataIncrement.emptyIncrement(), 
CompactIncrement.emptyIncrement(), true);
 
-        assertThat(peakBuilds).hasValue(1);
+        assertThat(peakBuilds).hasValue(2);
         assertThat(maintainer.buildNotCompleted()).isFalse();
     }
 
@@ -338,6 +633,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
         DataFileMeta source = dataFile("data-1", 3);
         AtomicInteger firstBuilds = new AtomicInteger();
         AtomicInteger secondBuilds = new AtomicInteger();
+        CountDownLatch firstStarted = new CountDownLatch(1);
         CountDownLatch secondStarted = new CountDownLatch(1);
         CountDownLatch blockSecond = new CountDownLatch(1);
         BucketedSortedIndexMaintainer first =
@@ -347,6 +643,7 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                         source,
                         dataFile -> {
                             int attempt = firstBuilds.incrementAndGet();
+                            firstStarted.countDown();
                             return payload("btree-" + attempt, source, 3, 7, 
"btree");
                         });
         BucketedSortedIndexMaintainer second =
@@ -378,25 +675,55 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                         });
 
         commitThread.start();
-        assertThat(secondStarted.await(5, TimeUnit.SECONDS)).isTrue();
-        commitThread.interrupt();
-        commitThread.join(TimeUnit.SECONDS.toMillis(5));
-
-        assertThat(commitThread.isAlive()).isFalse();
-        assertThat(failure.get()).isInstanceOf(InterruptedException.class);
-        assertThat(failedIncrement.newIndexFiles()).isEmpty();
-        assertThat(failedIncrement.deletedIndexFiles()).isEmpty();
-        assertThat(first.state().groups()).isEmpty();
-        assertThat(second.state().groups()).isEmpty();
-
-        CompactIncrement retryIncrement = compactAfter(source);
-        maintainer.prepareCommit(DataIncrement.emptyIncrement(), 
retryIncrement, true);
-
-        assertThat(firstBuilds).hasValue(2);
-        assertThat(secondBuilds).hasValue(2);
-        assertThat(retryIncrement.newIndexFiles())
-                .extracting(IndexFileMeta::fileName)
-                .containsExactly("btree-2", "bitmap-2");
+        try {
+            assertThat(firstStarted.await(5, TimeUnit.SECONDS)).isTrue();
+            assertThat(secondStarted.await(5, TimeUnit.SECONDS)).isTrue();
+            commitThread.interrupt();
+            commitThread.join(TimeUnit.SECONDS.toMillis(5));
+
+            assertThat(commitThread.isAlive()).isFalse();
+            assertThat(failure.get()).isInstanceOf(InterruptedException.class);
+            assertThat(failedIncrement.newIndexFiles()).isEmpty();
+            assertThat(failedIncrement.deletedIndexFiles()).isEmpty();
+            assertThat(first.state().groups()).isEmpty();
+            assertThat(second.state().groups()).isEmpty();
+
+            CompactIncrement retryIncrement = compactAfter(source);
+            maintainer.prepareCommit(DataIncrement.emptyIncrement(), 
retryIncrement, true);
+
+            assertThat(firstBuilds).hasValue(2);
+            assertThat(secondBuilds).hasValue(2);
+            assertThat(retryIncrement.newIndexFiles())
+                    .extracting(IndexFileMeta::fileName)
+                    .containsExactly("btree-2", "bitmap-2");
+        } finally {
+            blockSecond.countDown();
+            commitThread.interrupt();
+            commitThread.join(TimeUnit.SECONDS.toMillis(5));
+            maintainer.close();
+        }
+    }
+
+    private BucketedVectorIndexMaintainer vectorMaintainer(
+            int fieldId, PkVectorAnnSegmentFile indexFile) {
+        IndexFileHandler handler = mock(IndexFileHandler.class);
+        when(handler.pkVectorAnnSegment(any(), eq(0))).thenReturn(indexFile);
+        return new BucketedVectorIndexMaintainer.Factory(
+                        handler,
+                        mock(KeyValueFileReaderFactory.Builder.class, 
RETURNS_SELF),
+                        new DataField(
+                                fieldId,
+                                "vector_" + fieldId,
+                                DataTypes.VECTOR(2, DataTypes.FLOAT())),
+                        "l2",
+                        "vector")
+                .withIndexOptions(new Options())
+                .create(
+                        BinaryRow.EMPTY_ROW,
+                        0,
+                        Collections.emptyList(),
+                        Collections.emptyList(),
+                        buildExecutor);
     }
 
     private BucketedSortedIndexMaintainer sortedMaintainer(
@@ -414,6 +741,33 @@ class BucketedPrimaryKeyIndexMaintainerTest {
                 buildExecutor);
     }
 
+    private BucketedFullTextIndexMaintainer 
fullTextMaintainer(PkFullTextIndexBuilder builder) {
+        return new BucketedFullTextIndexMaintainer(
+                2,
+                mock(PkFullTextIndexFile.class),
+                builder,
+                Collections.emptyList(),
+                Collections.emptyList(),
+                buildExecutor);
+    }
+
+    private static IndexFileMeta blockedBuild(
+            IndexFileMeta payload,
+            AtomicInteger active,
+            AtomicInteger peak,
+            CountDownLatch started,
+            CountDownLatch release)
+            throws InterruptedException {
+        enterBuild(active, peak);
+        started.countDown();
+        try {
+            assertThat(release.await(10, TimeUnit.SECONDS)).isTrue();
+            return payload;
+        } finally {
+            active.decrementAndGet();
+        }
+    }
+
     private static void enterBuild(AtomicInteger activeBuilds, AtomicInteger 
peakBuilds) {
         int active = activeBuilds.incrementAndGet();
         while (true) {
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/index/pk/PrimaryKeyIndexDefinitionsTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/index/pk/PrimaryKeyIndexDefinitionsTest.java
index f3c9817680..543eca6fd5 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/index/pk/PrimaryKeyIndexDefinitionsTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/index/pk/PrimaryKeyIndexDefinitionsTest.java
@@ -39,6 +39,65 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 /** Tests for {@link PrimaryKeyIndexDefinitions}. */
 class PrimaryKeyIndexDefinitionsTest {
 
+    @ParameterizedTest
+    @ValueSource(booleans = {false, true})
+    void testCreatesIndependentVectorDefinitionsAndLeavesOtherVectorsUnindexed(
+            boolean sharedOptions) {
+        Map<String, String> options = new HashMap<>();
+        options.put(
+                columnsKey(sharedOptions ? "ivf-flat" : "vector", 
sharedOptions),
+                " text_embedding , image_embedding ");
+        if (!sharedOptions) {
+            options.put("fields.image_embedding.pk-vector.index.type", 
"ivf-flat");
+            options.put("fields.text_embedding.pk-vector.index.type", 
"ivf-flat");
+        }
+        String suffix = sharedOptions ? "index-options" : 
"pk-vector.index.options";
+        options.put(
+                "fields.image_embedding." + suffix,
+                "{\"nlist\":64,\"distance.metric\":\"cosine\"}");
+        options.put(
+                "fields.text_embedding." + suffix, 
"{\"nlist\":128,\"distance.metric\":\"l2\"}");
+        TableSchema schema =
+                new TableSchema(
+                        0,
+                        Arrays.asList(
+                                new DataField(0, "id", 
DataTypes.INT().notNull()),
+                                new DataField(
+                                        1,
+                                        "image_embedding",
+                                        DataTypes.VECTOR(2, 
DataTypes.FLOAT())),
+                                new DataField(
+                                        2,
+                                        "text_embedding",
+                                        DataTypes.VECTOR(3, 
DataTypes.FLOAT())),
+                                new DataField(
+                                        3,
+                                        "stored_embedding",
+                                        DataTypes.VECTOR(4, 
DataTypes.FLOAT()))),
+                        3,
+                        Collections.emptyList(),
+                        Collections.singletonList("id"),
+                        options,
+                        "");
+
+        List<PrimaryKeyIndexDefinition> definitions =
+                PrimaryKeyIndexDefinitions.create(schema).definitions();
+
+        assertThat(definitions)
+                .extracting(PrimaryKeyIndexDefinition::column)
+                .containsExactly("image_embedding", "text_embedding");
+        assertThat(definitions)
+                .extracting(PrimaryKeyIndexDefinition::fieldId)
+                .containsExactly(1, 2);
+        assertThat(definitions)
+                .extracting(PrimaryKeyIndexDefinition::family)
+                .containsOnly(PrimaryKeyIndexDefinition.Family.VECTOR);
+        
assertThat(definitions.get(0).options().get("ivf-flat.nlist")).isEqualTo("64");
+        
assertThat(definitions.get(0).options().get("ivf-flat.metric")).isEqualTo("cosine");
+        
assertThat(definitions.get(1).options().get("ivf-flat.nlist")).isEqualTo("128");
+        
assertThat(definitions.get(1).options().get("ivf-flat.metric")).isEqualTo("l2");
+    }
+
     @ParameterizedTest
     @ValueSource(booleans = {false, true})
     void testCreatesMixedDefinitionsInSchemaFieldOrder(boolean sharedOptions) {
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/index/pksorted/PrimaryKeySortedIndexMaintenanceTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/index/pksorted/PrimaryKeySortedIndexMaintenanceTest.java
index 1d337e4030..788f310e94 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/index/pksorted/PrimaryKeySortedIndexMaintenanceTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/index/pksorted/PrimaryKeySortedIndexMaintenanceTest.java
@@ -58,9 +58,9 @@ import org.apache.paimon.utils.RecordWriter;
 
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
 import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
 import org.junit.jupiter.params.provider.ValueSource;
 
 import java.io.IOException;
@@ -93,9 +93,10 @@ class PrimaryKeySortedIndexMaintenanceTest {
     }
 
     @ParameterizedTest
-    @ValueSource(booleans = {false, true})
-    void testBuildRestoreAndReplaceSourceGroups(boolean sharedOptions) throws 
Exception {
-        TestFileStore store = createStore(sharedOptions);
+    @CsvSource({"false,1", "false,2", "true,1", "true,2"})
+    void testBuildRestoreAndReplaceSourceGroups(boolean sharedOptions, int 
parallelism)
+            throws Exception {
+        TestFileStore store = createStore(sharedOptions, parallelism);
         TestKeyValueGenerator generator = new TestKeyValueGenerator();
         List<KeyValue> firstBatch =
                 Arrays.asList(
@@ -145,9 +146,10 @@ class PrimaryKeySortedIndexMaintenanceTest {
         restored.close();
     }
 
-    @Test
-    void testRestoreMixedVectorAndScalarPayloads() throws Exception {
-        TestFileStore store = createMixedStore();
+    @ParameterizedTest
+    @ValueSource(ints = {1, 2})
+    void testRestoreMixedVectorAndScalarPayloads(int parallelism) throws 
Exception {
+        TestFileStore store = createMixedStore(parallelism);
         TestKeyValueGenerator generator = new TestKeyValueGenerator();
         KeyValue first =
                 withVector(
@@ -320,8 +322,9 @@ class PrimaryKeySortedIndexMaintenanceTest {
         return record.replaceValue(extended);
     }
 
-    private TestFileStore createStore(boolean sharedOptions) throws Exception {
+    private TestFileStore createStore(boolean sharedOptions, int parallelism) 
throws Exception {
         Map<String, String> options = new HashMap<>();
+        options.put(CoreOptions.PK_INDEX_BUILD_PARALLELISM.key(), 
String.valueOf(parallelism));
         options.put(CoreOptions.BUCKET.key(), "1");
         options.put(CoreOptions.DELETION_VECTORS_ENABLED.key(), "true");
         options.put(CoreOptions.COMPACTION_FORCE_REWRITE_ALL_FILES.key(), 
"true");
@@ -359,8 +362,9 @@ class PrimaryKeySortedIndexMaintenanceTest {
                 .build();
     }
 
-    private TestFileStore createMixedStore() throws Exception {
+    private TestFileStore createMixedStore(int parallelism) throws Exception {
         Map<String, String> options = new HashMap<>();
+        options.put(CoreOptions.PK_INDEX_BUILD_PARALLELISM.key(), 
String.valueOf(parallelism));
         options.put(CoreOptions.BUCKET.key(), "1");
         options.put(CoreOptions.DELETION_VECTORS_ENABLED.key(), "true");
         options.put(CoreOptions.COMPACTION_FORCE_REWRITE_ALL_FILES.key(), 
"true");
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainerTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainerTest.java
index 3553f858ed..e6b1986a07 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainerTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/index/pkvector/BucketedVectorIndexMaintainerTest.java
@@ -38,6 +38,8 @@ import org.apache.paimon.types.DataTypes;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.io.TempDir;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 import java.io.IOException;
 import java.io.UncheckedIOException;
@@ -138,13 +140,19 @@ class BucketedVectorIndexMaintainerTest {
         assertThat(fileCount()).isZero();
     }
 
-    @Test
-    void testNonBlockingPrepareCommitPublishesCompletedAnnLater() throws 
Exception {
+    @ParameterizedTest
+    @ValueSource(booleans = {false, true})
+    void testNonBlockingPrepareCommitPublishesCompletedAnnLater(boolean 
replaceExisting)
+            throws Exception {
         LocalFileIO fileIO = LocalFileIO.create();
         PkVectorAnnSegmentFile annFile = new PkVectorAnnSegmentFile(fileIO, 
pathFactory());
         DataField vectorField =
                 new DataField(7, "embedding", DataTypes.VECTOR(2, 
DataTypes.FLOAT()));
         DataFileMeta data = dataFile("data");
+        DataFileMeta oldData = dataFile("old-data");
+        IndexFileMeta oldAnn = payload("old-ann", oldData, 7, 
"test-vector-ann");
+        List<DataFileMeta> previousSources =
+                replaceExisting ? Collections.singletonList(oldData) : 
Collections.emptyList();
         PkVectorDataFileReader.Factory readerFactory = 
mock(PkVectorDataFileReader.Factory.class);
         CountDownLatch buildStarted = new CountDownLatch(1);
         CountDownLatch allowBuild = new CountDownLatch(1);
@@ -168,20 +176,29 @@ class BucketedVectorIndexMaintainerTest {
                             "l2",
                             "test-vector-ann",
                             readerFactory,
-                            Collections.emptyList(),
-                            Collections.emptyList(),
+                            previousSources,
+                            replaceExisting
+                                    ? Collections.singletonList(oldAnn)
+                                    : Collections.emptyList(),
                             executor);
 
             BucketedVectorIndexMaintainer.VectorIndexCommit firstCommit =
                     maintainer.prepareCommit(
                             DataIncrement.emptyIncrement(),
                             new CompactIncrement(
-                                    Collections.emptyList(),
+                                    previousSources,
                                     Collections.singletonList(data),
                                     Collections.emptyList()),
                             false);
 
-            assertThat(firstCommit.compactIncrement()).isEmpty();
+            if (replaceExisting) {
+                
assertThat(firstCommit.compactIncrement().get().deletedIndexFiles())
+                        .containsExactly(oldAnn);
+                
assertThat(firstCommit.compactIncrement().get().newIndexFiles()).isEmpty();
+                assertThat(maintainer.segments()).isEmpty();
+            } else {
+                assertThat(firstCommit.compactIncrement()).isEmpty();
+            }
             assertThat(buildStarted.await(30, TimeUnit.SECONDS)).isTrue();
             assertThat(buildThread.get()).isNotSameAs(callerThread);
             allowBuild.countDown();
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/index/pkvector/PrimaryKeyVectorIndexOptionsTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/index/pkvector/PrimaryKeyVectorIndexOptionsTest.java
index f1cd6d47bc..76585bcd66 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/index/pkvector/PrimaryKeyVectorIndexOptionsTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/index/pkvector/PrimaryKeyVectorIndexOptionsTest.java
@@ -42,11 +42,26 @@ class PrimaryKeyVectorIndexOptionsTest {
     }
 
     @Test
-    void testResolvesSingleIndexColumn() {
+    void testResolvesIndependentOptionsForSameAlgorithm() {
         Map<String, String> options = new HashMap<>();
-        options.put("pk-vector.index.columns", "embedding");
-
-        assertThat(VectorIndexOptions.columns(new 
Options(options))).containsExactly("embedding");
+        options.put("pk-vector.index.columns", " embedding , other_embedding 
");
+        options.put("fields.embedding.pk-vector.index.type", "ivf-flat");
+        options.put("fields.other_embedding.pk-vector.index.type", "ivf-flat");
+        options.put("fields.embedding.pk-vector.distance.metric", "cosine");
+        options.put("fields.other_embedding.pk-vector.distance.metric", "l2");
+        options.put("fields.embedding.pk-vector.index.options", 
"{\"nlist\":64}");
+        options.put("fields.other_embedding.pk-vector.index.options", 
"{\"nlist\":128}");
+        Options configuration = new Options(options);
+
+        assertThat(VectorIndexOptions.columns(configuration))
+                .containsExactly("embedding", "other_embedding");
+        Options first = VectorIndexOptions.resolve(configuration, null, 
"embedding").options();
+        Options second =
+                VectorIndexOptions.resolve(configuration, null, 
"other_embedding").options();
+        assertThat(first.get("ivf-flat.nlist")).isEqualTo("64");
+        assertThat(first.get("ivf-flat.metric")).isEqualTo("cosine");
+        assertThat(second.get("ivf-flat.nlist")).isEqualTo("128");
+        assertThat(second.get("ivf-flat.metric")).isEqualTo("l2");
     }
 
     @Test
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyIndexWriteTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyIndexWriteTest.java
index 0ac8c5dd46..c82208f698 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyIndexWriteTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyIndexWriteTest.java
@@ -123,12 +123,15 @@ class PrimaryKeyIndexWriteTest {
         options.put(CoreOptions.GLOBAL_INDEX_BITMAP_INDEX_COLUMNS.key(), 
"comment,state");
         options.put("pk-vector.index.columns", "embedding");
         options.put("fields.embedding.pk-vector.index.type", "hnsw");
+        options.put(CoreOptions.GLOBAL_INDEX_FULL_TEXT_INDEX_COLUMNS.key(), 
"full_text");
+        options.put(CoreOptions.PK_INDEX_BUILD_PARALLELISM.key(), "2");
 
         List<DataField> fields =
                 new 
ArrayList<>(TestKeyValueGenerator.DEFAULT_ROW_TYPE.getFields());
         fields.add(new DataField(7, "score", DataTypes.BIGINT()));
         fields.add(new DataField(8, "state", DataTypes.INT()));
         fields.add(new DataField(9, "embedding", DataTypes.VECTOR(3, 
DataTypes.FLOAT())));
+        fields.add(new DataField(10, "full_text", DataTypes.STRING()));
         TestFileStore store = createStore(options, new RowType(fields));
         KeyValueFileStoreWrite write = (KeyValueFileStoreWrite) 
store.newWrite();
         write.withIOManager(ioManager);
@@ -138,12 +141,27 @@ class PrimaryKeyIndexWriteTest {
         AbstractFileStoreWrite.WriterContainer<KeyValue> container =
                 write.createWriterContainer(generator.getPartition(record), 1);
 
-        Object vectorMaintainer =
-                readField(container.primaryKeyIndexMaintainer, 
"vectorMaintainer");
-        assertThat(vectorMaintainer).isNotNull();
+        List<?> vectorMaintainers =
+                (List<?>) readField(container.primaryKeyIndexMaintainer, 
"vectorMaintainers");
+        assertThat(vectorMaintainers).hasSize(1);
+        Object vectorMaintainer = vectorMaintainers.get(0);
         assertThat((List<?>) readField(container.primaryKeyIndexMaintainer, 
"sortedMaintainers"))
                 .hasSize(4);
 
+        Object executor = readField(vectorMaintainer, "executor");
+        Object fullText = readField(container.primaryKeyIndexMaintainer, 
"fullTextMaintainer");
+        assertThat(readField(fullText, "executor")).isSameAs(executor);
+        for (Object sorted :
+                (List<?>) readField(container.primaryKeyIndexMaintainer, 
"sortedMaintainers")) {
+            assertThat(readField(sorted, "executor")).isSameAs(executor);
+        }
+        AbstractFileStoreWrite.WriterContainer<KeyValue> otherBucket =
+                write.createWriterContainer(generator.getPartition(record), 2);
+        Object otherVector =
+                ((List<?>) readField(otherBucket.primaryKeyIndexMaintainer, 
"vectorMaintainers"))
+                        .get(0);
+        assertThat(readField(otherVector, "executor")).isSameAs(executor);
+
         BitmapDeletionVector deletionVector = new BitmapDeletionVector();
         deletionVector.delete(1);
         container.deletionVectorsMaintainer.deletionVectors().put("data-file", 
deletionVector);
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyVectorIndexWriteTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyVectorIndexWriteTest.java
index 9b2aa3dcb1..ca58f124cb 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyVectorIndexWriteTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/operation/PrimaryKeyVectorIndexWriteTest.java
@@ -23,6 +23,8 @@ import org.apache.paimon.data.BinaryRow;
 import org.apache.paimon.deletionvectors.BucketedDvMaintainer;
 import org.apache.paimon.index.IndexFileMeta;
 import org.apache.paimon.index.pk.BucketedPrimaryKeyIndexMaintainer;
+import org.apache.paimon.index.pkfulltext.BucketedFullTextIndexMaintainer;
+import org.apache.paimon.index.pksorted.BucketedSortedIndexMaintainer;
 import org.apache.paimon.index.pkvector.BucketedVectorIndexMaintainer;
 import org.apache.paimon.io.CompactIncrement;
 import org.apache.paimon.io.DataFileMeta;
@@ -34,19 +36,25 @@ import org.apache.paimon.utils.RecordWriter;
 import org.apache.paimon.utils.SnapshotManager;
 
 import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
 
 import javax.annotation.Nullable;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Optional;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 
 import static org.apache.paimon.data.BinaryRow.EMPTY_ROW;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.same;
 import static org.mockito.Mockito.mock;
@@ -57,7 +65,7 @@ import static org.mockito.Mockito.when;
 class PrimaryKeyVectorIndexWriteTest {
 
     @Test
-    void testRestoreRebindsVectorIndexExecutor() throws Exception {
+    void testRestoreRebindsSharedIndexExecutor() throws Exception {
         DataIncrement dataIncrement = DataIncrement.emptyIncrement();
         CompactIncrement compactIncrement = CompactIncrement.emptyIncrement();
         RecordWriter<String> writer = mock(RecordWriter.class);
@@ -69,17 +77,66 @@ class PrimaryKeyVectorIndexWriteTest {
         when(vectorCommit.appendIncrement()).thenReturn(Optional.empty());
         when(vectorCommit.compactIncrement()).thenReturn(Optional.empty());
         BucketedVectorIndexMaintainer maintainer = 
mock(BucketedVectorIndexMaintainer.class);
+        when(maintainer.prepareCommit(same(dataIncrement), 
same(compactIncrement), eq(false)))
+                .thenReturn(vectorCommit);
         when(maintainer.prepareCommit(same(dataIncrement), 
same(compactIncrement), eq(true)))
                 .thenReturn(vectorCommit);
+        BucketedVectorIndexMaintainer secondMaintainer = 
mock(BucketedVectorIndexMaintainer.class);
+        when(secondMaintainer.prepareCommit(same(dataIncrement), 
same(compactIncrement), eq(false)))
+                .thenReturn(vectorCommit);
+        when(secondMaintainer.prepareCommit(same(dataIncrement), 
same(compactIncrement), eq(true)))
+                .thenReturn(vectorCommit);
 
         TestingFileStoreWrite write = new TestingFileStoreWrite();
-        write.install(writer, maintainer);
+        BucketedFullTextIndexMaintainer fullText = 
mock(BucketedFullTextIndexMaintainer.class);
+        when(fullText.prepareCommit(any(), any(), anyBoolean()))
+                
.thenReturn(mock(BucketedFullTextIndexMaintainer.FullTextIndexCommit.class));
+        BucketedSortedIndexMaintainer sorted = 
mock(BucketedSortedIndexMaintainer.class);
+        when(sorted.prepareCommit(any(), any(), anyBoolean()))
+                
.thenReturn(mock(BucketedSortedIndexMaintainer.SortedIndexCommit.class));
+        write.install(
+                writer,
+                BucketedPrimaryKeyIndexMaintainer.ofVectors(
+                        Arrays.asList(maintainer, secondMaintainer),
+                        fullText,
+                        Collections.singletonList(sorted)));
         List<FileStoreWrite.State<String>> states = write.checkpoint();
 
-        TestingFileStoreWrite restored = new 
TestingFileStoreWrite(mock(RecordWriter.class));
+        TestingFileStoreWrite restored = new 
TestingFileStoreWrite(mock(RecordWriter.class), 2);
         restored.restore(states);
 
-        verify(maintainer).withExecutor(any(ExecutorService.class));
+        ArgumentCaptor<ExecutorService> executor = 
ArgumentCaptor.forClass(ExecutorService.class);
+        verify(maintainer).withExecutor(executor.capture());
+        verify(secondMaintainer).withExecutor(same(executor.getValue()));
+        verify(fullText).withExecutor(same(executor.getValue()));
+        verify(sorted).withExecutor(same(executor.getValue()));
+        CountDownLatch started = new CountDownLatch(2);
+        CountDownLatch release = new CountDownLatch(1);
+        try {
+            Future<?> first =
+                    executor.getValue()
+                            .submit(
+                                    () -> {
+                                        started.countDown();
+                                        return release.await(10, 
TimeUnit.SECONDS);
+                                    });
+            Future<?> second =
+                    executor.getValue()
+                            .submit(
+                                    () -> {
+                                        started.countDown();
+                                        return release.await(10, 
TimeUnit.SECONDS);
+                                    });
+            assertThat(started.await(5, TimeUnit.SECONDS)).isTrue();
+            release.countDown();
+            assertThat(first.get(5, TimeUnit.SECONDS)).isEqualTo(true);
+            assertThat(second.get(5, TimeUnit.SECONDS)).isEqualTo(true);
+        } finally {
+            release.countDown();
+            restored.close();
+            write.close();
+        }
+        assertThat(executor.getValue().isShutdown()).isTrue();
     }
 
     @Test
@@ -143,10 +200,11 @@ class PrimaryKeyVectorIndexWriteTest {
         @Nullable private final RecordWriter<String> restoredWriter;
 
         private TestingFileStoreWrite() {
-            this(null);
+            this(null, 1);
         }
 
-        private TestingFileStoreWrite(@Nullable RecordWriter<String> 
restoredWriter) {
+        private TestingFileStoreWrite(
+                @Nullable RecordWriter<String> restoredWriter, int 
buildParallelism) {
             super(
                     mock(SnapshotManager.class),
                     mock(FileStoreScan.class),
@@ -154,23 +212,26 @@ class PrimaryKeyVectorIndexWriteTest {
                     null,
                     null,
                     "test-table",
-                    new CoreOptions(new HashMap<>()),
+                    new CoreOptions(
+                            Collections.singletonMap(
+                                    
CoreOptions.PK_INDEX_BUILD_PARALLELISM.key(),
+                                    String.valueOf(buildParallelism))),
                     RowType.of());
             this.restoredWriter = restoredWriter;
         }
 
         private void install(
-                RecordWriter<String> writer, BucketedVectorIndexMaintainer 
vectorMaintainer) {
+                RecordWriter<String> writer, BucketedVectorIndexMaintainer... 
vectorMaintainers) {
+            install(
+                    writer,
+                    BucketedPrimaryKeyIndexMaintainer.ofVectors(
+                            Arrays.asList(vectorMaintainers), null, 
Collections.emptyList()));
+        }
+
+        private void install(
+                RecordWriter<String> writer, BucketedPrimaryKeyIndexMaintainer 
maintainer) {
             writers.computeIfAbsent(EMPTY_ROW, ignored -> new HashMap<>())
-                    .put(
-                            0,
-                            new WriterContainer<>(
-                                    writer,
-                                    1,
-                                    null,
-                                    null,
-                                    
BucketedPrimaryKeyIndexMaintainer.ofVector(vectorMaintainer),
-                                    null));
+                    .put(0, new WriterContainer<>(writer, 1, null, null, 
maintainer, null));
         }
 
         @Override
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/table/source/PrimaryKeyVectorSearchTest.java
 
b/paimon-core/src/test/java/org/apache/paimon/table/source/PrimaryKeyVectorSearchTest.java
index f23ea1f0a1..5d3e7af967 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/table/source/PrimaryKeyVectorSearchTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/table/source/PrimaryKeyVectorSearchTest.java
@@ -26,15 +26,20 @@ import org.apache.paimon.data.InternalRow;
 import org.apache.paimon.globalindex.GlobalIndexResult;
 import org.apache.paimon.globalindex.IndexedSplit;
 import org.apache.paimon.globalindex.testvector.TestVectorGlobalIndexerFactory;
+import org.apache.paimon.index.IndexFileMeta;
 import org.apache.paimon.predicate.PredicateBuilder;
 import org.apache.paimon.reader.RecordReader;
 import org.apache.paimon.schema.Schema;
+import org.apache.paimon.schema.SchemaChange;
 import org.apache.paimon.table.FileStoreTable;
 import org.apache.paimon.table.TableTestBase;
 import org.apache.paimon.table.sink.BatchTableCommit;
 import org.apache.paimon.table.sink.BatchTableWrite;
 import org.apache.paimon.table.sink.BatchWriteBuilder;
+import org.apache.paimon.table.sink.CommitMessage;
+import org.apache.paimon.table.sink.CommitMessageImpl;
 import org.apache.paimon.types.DataTypes;
+import org.apache.paimon.types.RowKind;
 
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -46,6 +51,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static java.util.stream.Collectors.toList;
 import static org.assertj.core.api.Assertions.assertThat;
 
 /** End-to-end tests for bucket-local primary-key vector search. */
@@ -154,6 +160,214 @@ class PrimaryKeyVectorSearchTest extends TableTestBase {
         return builder.build();
     }
 
+    @ParameterizedTest
+    @ValueSource(ints = {1, 2})
+    void testIndependentVectorIndexesSurviveReopenAndCompaction(int 
buildParallelism)
+            throws Exception {
+        catalog.createTable(
+                identifier(), multipleVectorSchema(2, "l2", "l2", 
buildParallelism), false);
+        FileStoreTable table = getTableDefault();
+        write(
+                table,
+                ioManager,
+                GenericRow.of(1, vector(1, 0), vector(9, 0)),
+                GenericRow.of(2, vector(2, 0), vector(8, 0)));
+        write(
+                table,
+                ioManager,
+                GenericRow.of(3, vector(8, 0), vector(2, 0)),
+                GenericRow.of(4, vector(9, 0), vector(1, 0)));
+        compact(table, BinaryRow.EMPTY_ROW, 0, ioManager, true);
+        assertMultipleVectorPayloads(table);
+
+        // Identical algorithms and dimensions must not cause one field's 
payload to serve another.
+        FileStoreTable reopened = getTableDefault();
+        assertThat(searchIds(reopened, "image_embedding", new float[] {0, 0}, 
1))
+                .containsExactly(1);
+        assertThat(searchIds(reopened, "text_embedding", new float[] {0, 0}, 
1)).containsExactly(4);
+
+        // A new writer restores both indexes before replacing their source 
files.
+        write(
+                reopened,
+                ioManager,
+                GenericRow.of(1, vector(10, 0), vector(0.5f, 0)),
+                GenericRow.of(2, null, vector(7, 0)),
+                GenericRow.of(3, vector(8, 0), null),
+                GenericRow.ofKind(RowKind.DELETE, 4, vector(9, 0), vector(1, 
0)));
+        compact(reopened, BinaryRow.EMPTY_ROW, 0, ioManager, true);
+        assertMultipleVectorPayloads(reopened);
+
+        FileStoreTable restored = getTableDefault();
+        assertThat(searchIds(restored, "image_embedding", new float[] {0, 0}, 
1))
+                .containsExactly(3);
+        assertThat(searchIds(restored, "text_embedding", new float[] {0, 0}, 
1)).containsExactly(1);
+        assertThat(searchIds(restored, "image_embedding", new float[] {0, 0}, 
10))
+                .containsExactlyInAnyOrder(1, 3);
+        assertThat(searchIds(restored, "text_embedding", new float[] {0, 0}, 
10))
+                .containsExactlyInAnyOrder(1, 2);
+    }
+
+    @ParameterizedTest
+    @ValueSource(ints = {1, 2})
+    void testIndependentVectorIndexesWithDifferentDimensionsAndMetrics(int 
buildParallelism)
+            throws Exception {
+        catalog.createTable(
+                identifier(), multipleVectorSchema(3, "l2", "cosine", 
buildParallelism), false);
+        FileStoreTable table = getTableDefault();
+        write(table, ioManager, GenericRow.of(1, vector(1, 0), vector(1, 1, 
0)));
+        write(table, ioManager, GenericRow.of(2, vector(2, 0), vector(10, 0, 
0)));
+        compact(table, BinaryRow.EMPTY_ROW, 0, ioManager, true);
+        assertMultipleVectorPayloads(table);
+
+        FileStoreTable reopened = getTableDefault();
+        assertThat(searchIds(reopened, "image_embedding", new float[] {0, 0}, 
1))
+                .containsExactly(1);
+        // Cosine ranks id 2 first, whereas L2 would rank id 1 first for this 
field.
+        assertThat(searchIds(reopened, "text_embedding", new float[] {1, 0, 
0}, 1))
+                .containsExactly(2);
+
+        List<GlobalIndexResult> results =
+                reopened.newBatchVectorSearchBuilder()
+                        .withVectorColumn("text_embedding")
+                        .withVectors(new float[][] {{1, 0, 0}, {0, 1, 0}})
+                        .withLimit(1)
+                        .executeBatchLocal();
+        assertThat(results).hasSize(2);
+        assertThat(readIds(reopened, results.get(0))).containsExactly(2);
+        assertThat(readIds(reopened, results.get(1))).containsExactly(1);
+    }
+
+    @ParameterizedTest
+    @ValueSource(ints = {1, 2})
+    void testCompactionBackfillsAddedVectorIndexWithoutNewData(int 
buildParallelism)
+            throws Exception {
+        Schema schema = multipleVectorSchema(2, "l2", "l2", buildParallelism);
+        schema.options()
+                .put(
+                        "global-index."
+                                + TestVectorGlobalIndexerFactory.IDENTIFIER
+                                + ".index-columns",
+                        "image_embedding");
+        catalog.createTable(identifier(), schema, false);
+        FileStoreTable original = getTableDefault();
+        write(original, ioManager, GenericRow.of(1, vector(1, 0), vector(9, 
0)));
+        write(original, ioManager, GenericRow.of(2, vector(9, 0), vector(1, 
0)));
+        compact(original, BinaryRow.EMPTY_ROW, 0, ioManager, true);
+        List<IndexFileMeta> originalPayloads = vectorPayloads(original);
+        assertThat(originalPayloads).hasSize(1);
+        assertThat(originalPayloads.get(0).globalIndexMeta().indexFieldId())
+                
.isEqualTo(original.rowType().getField("image_embedding").id());
+
+        catalog.alterTable(
+                identifier(),
+                Collections.singletonList(
+                        SchemaChange.setOption(
+                                "global-index."
+                                        + 
TestVectorGlobalIndexerFactory.IDENTIFIER
+                                        + ".index-columns",
+                                "image_embedding,text_embedding")),
+                false);
+        FileStoreTable reopened = getTableDefault();
+        assertThat(searchIds(reopened, "image_embedding", new float[] {0, 0}, 
1))
+                .containsExactly(1);
+        assertThat(searchIds(reopened, "text_embedding", new float[] {0, 0}, 
1)).isEmpty();
+
+        // A fresh compactor must discover the coverage gap even without a 
data-file transition.
+        BatchWriteBuilder writeBuilder = reopened.newBatchWriteBuilder();
+        try (BatchTableWrite write = writeBuilder.newWrite();
+                BatchTableCommit commit = writeBuilder.newCommit()) {
+            write.withIOManager(ioManager);
+            write.compact(BinaryRow.EMPTY_ROW, 0, true);
+            List<CommitMessage> messages = write.prepareCommit();
+            assertThat(messages).hasSize(1);
+            CommitMessageImpl message = (CommitMessageImpl) messages.get(0);
+            assertThat(message.newFilesIncrement().newFiles()).isEmpty();
+            assertThat(message.compactIncrement().compactBefore()).isEmpty();
+            assertThat(message.compactIncrement().compactAfter()).isEmpty();
+            assertThat(message.newFilesIncrement().newIndexFiles())
+                    .extracting(payload -> 
payload.globalIndexMeta().indexFieldId())
+                    
.containsExactly(reopened.rowType().getField("text_embedding").id());
+            
assertThat(message.newFilesIncrement().deletedIndexFiles()).isEmpty();
+            
assertThat(message.compactIncrement().deletedIndexFiles()).isEmpty();
+            commit.commit(messages);
+        }
+
+        FileStoreTable restored = getTableDefault();
+        assertMultipleVectorPayloads(restored);
+        List<IndexFileMeta> completedPayloads = vectorPayloads(restored);
+        assertThat(completedPayloads)
+                .extracting(IndexFileMeta::fileName)
+                .contains(originalPayloads.get(0).fileName());
+        assertThat(searchIds(restored, "image_embedding", new float[] {0, 0}, 
1))
+                .containsExactly(1);
+        assertThat(searchIds(restored, "text_embedding", new float[] {0, 0}, 
1)).containsExactly(2);
+
+        compact(restored, BinaryRow.EMPTY_ROW, 0, ioManager, true);
+        assertThat(vectorPayloads(getTableDefault()))
+                .extracting(IndexFileMeta::fileName)
+                .containsExactlyInAnyOrderElementsOf(
+                        
completedPayloads.stream().map(IndexFileMeta::fileName).collect(toList()));
+    }
+
+    private Schema multipleVectorSchema(
+            int textDimension, String imageMetric, String textMetric, int 
buildParallelism) {
+        return Schema.newBuilder()
+                .column("id", DataTypes.INT())
+                .column("image_embedding", DataTypes.VECTOR(2, 
DataTypes.FLOAT()))
+                .column("text_embedding", DataTypes.VECTOR(textDimension, 
DataTypes.FLOAT()))
+                .primaryKey("id")
+                .option(
+                        CoreOptions.PK_INDEX_BUILD_PARALLELISM.key(),
+                        String.valueOf(buildParallelism))
+                .option(CoreOptions.BUCKET.key(), "1")
+                .option(CoreOptions.DELETION_VECTORS_ENABLED.key(), "true")
+                .option(
+                        "global-index."
+                                + TestVectorGlobalIndexerFactory.IDENTIFIER
+                                + ".index-columns",
+                        "image_embedding,text_embedding")
+                .option("fields.image_embedding.distance.metric", imageMetric)
+                .option("fields.text_embedding.distance.metric", textMetric)
+                .option("fields.image_embedding.vector-index.search-mode", 
"fast")
+                .option("fields.text_embedding.vector-index.search-mode", 
"fast")
+                .build();
+    }
+
+    private static BinaryVector vector(float... values) {
+        return BinaryVector.fromPrimitiveArray(values);
+    }
+
+    private static void assertMultipleVectorPayloads(FileStoreTable table) {
+        List<IndexFileMeta> payloads = vectorPayloads(table);
+        assertThat(payloads)
+                .extracting(payload -> 
payload.globalIndexMeta().indexFieldId())
+                .containsExactlyInAnyOrder(
+                        table.rowType().getField("image_embedding").id(),
+                        table.rowType().getField("text_embedding").id());
+        assertThat(payloads)
+                .extracting(IndexFileMeta::indexType)
+                .containsOnly(TestVectorGlobalIndexerFactory.IDENTIFIER);
+        
assertThat(payloads).extracting(IndexFileMeta::fileName).doesNotHaveDuplicates();
+    }
+
+    private static List<IndexFileMeta> vectorPayloads(FileStoreTable table) {
+        return table.store()
+                .newIndexFileHandler()
+                .scanSourceIndexes(
+                        table.store().snapshotManager().latestSnapshot(), 
BinaryRow.EMPTY_ROW, 0);
+    }
+
+    private static List<Integer> searchIds(
+            FileStoreTable table, String field, float[] query, int limit) 
throws Exception {
+        return readIds(
+                table,
+                table.newVectorSearchBuilder()
+                        .withVectorColumn(field)
+                        .withVector(query)
+                        .withLimit(limit)
+                        .executeLocal());
+    }
+
     @Test
     void testRefineFactorReranksAnnCandidates() throws Exception {
         catalog.createTable(identifier(), vectorSchema("deduplicate", true, 
true), false);
diff --git 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/procedure/VectorSearchProcedureITCase.java
 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/procedure/VectorSearchProcedureITCase.java
index 5d98d24fd1..a874a5030f 100644
--- 
a/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/procedure/VectorSearchProcedureITCase.java
+++ 
b/paimon-flink/paimon-flink-common/src/test/java/org/apache/paimon/flink/procedure/VectorSearchProcedureITCase.java
@@ -48,6 +48,8 @@ import org.apache.paimon.table.source.VectorScan;
 import org.apache.paimon.types.DataField;
 import org.apache.paimon.utils.Range;
 
+import org.apache.flink.client.program.ClusterClient;
+import org.apache.flink.runtime.client.JobStatusMessage;
 import org.apache.flink.table.api.config.TableConfigOptions;
 import org.apache.flink.types.Row;
 import org.junit.jupiter.api.Test;
@@ -55,6 +57,7 @@ import org.junit.jupiter.api.Test;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
@@ -202,6 +205,86 @@ public class VectorSearchProcedureITCase extends 
CatalogITCaseBase {
                                         && !row.contains("\"vec\""));
     }
 
+    @Test
+    public void testDistributedPrimaryKeySearchWithMultipleVectorIndexes() 
throws Exception {
+        sql(
+                "CREATE TABLE MULTI_VECTOR_PK_T ("
+                        + "id INT, image_vec ARRAY<FLOAT>, text_vec 
ARRAY<FLOAT>, "
+                        + "PRIMARY KEY (id) NOT ENFORCED) WITH ("
+                        + "'bucket' = '4', "
+                        + "'file.format' = 'json', "
+                        + "'file.compression' = 'none', "
+                        + "'deletion-vectors.enabled' = 'true', "
+                        + "'vector-field' = 'image_vec,text_vec', "
+                        + "'field.image_vec.vector-dim' = '2', "
+                        + "'field.text_vec.vector-dim' = '2', "
+                        + "'pk-vector.index.columns' = 'image_vec,text_vec', "
+                        + "'fields.image_vec.pk-vector.index.type' = '%s', "
+                        + "'fields.text_vec.pk-vector.index.type' = '%s', "
+                        + "'fields.image_vec.pk-vector.distance.metric' = 
'l2', "
+                        + "'fields.text_vec.pk-vector.distance.metric' = 'l2', 
"
+                        + "'vector-index.search-mode' = 'fast', "
+                        + "'vector-search.distribute.enabled' = 'true', "
+                        + "'global-index.thread-num' = '2')",
+                TestVectorGlobalIndexerFactory.IDENTIFIER,
+                TestVectorGlobalIndexerFactory.IDENTIFIER);
+        String values =
+                IntStream.range(0, 32)
+                        .mapToObj(
+                                i ->
+                                        String.format(
+                                                "(%d, ARRAY[CAST(%d AS FLOAT), 
CAST(0 AS FLOAT)], "
+                                                        + "ARRAY[CAST(%d AS 
FLOAT), CAST(0 AS FLOAT)])",
+                                                i, i, 31 - i))
+                        .collect(Collectors.joining(","));
+        sql("INSERT INTO MULTI_VECTOR_PK_T VALUES " + values);
+        sql(
+                "CALL sys.compact(`table` => 'default.MULTI_VECTOR_PK_T', "
+                        + "compact_strategy => 'full', "
+                        + "options => 
'compaction.force-rewrite-all-files=true')");
+        assertThat(sql("SELECT DISTINCT bucket FROM 
`MULTI_VECTOR_PK_T$files`")).hasSize(4);
+        FileStoreTable table = paimonTable("MULTI_VECTOR_PK_T");
+        for (int bucket = 0; bucket < 4; bucket++) {
+            assertThat(
+                            table.store()
+                                    .newIndexFileHandler()
+                                    .scanSourceIndexes(
+                                            table.latestSnapshot().get(),
+                                            BinaryRow.EMPTY_ROW,
+                                            bucket))
+                    .extracting(payload -> 
payload.globalIndexMeta().indexFieldId())
+                    .containsExactlyInAnyOrder(
+                            table.rowType().getField("image_vec").id(),
+                            table.rowType().getField("text_vec").id());
+        }
+
+        for (String field : Arrays.asList("image_vec", "text_vec")) {
+            assertThat(
+                            sql(
+                                    "CALL sys.vector_search("
+                                            + "`table` => 
'default.MULTI_VECTOR_PK_T', "
+                                            + "vector_column => '%s', "
+                                            + "query_vector => '0.0,0.0', "
+                                            + "top_k => 1, projection => 
'id')",
+                                    field))
+                    .extracting(row -> row.getField(0).toString())
+                    .containsExactly(
+                            field.equals("image_vec") ? "{\"id\":\"0\"}" : 
"{\"id\":\"31\"}");
+        }
+
+        // Both fields must run the distributed search operator, not the local 
fallback.
+        try (ClusterClient<?> client = 
MINI_CLUSTER_EXTENSION.createRestClusterClient()) {
+            assertThat(client.listJobs().get(30, TimeUnit.SECONDS))
+                    .filteredOn(
+                            job ->
+                                    job.getJobName().contains("Primary-Key 
Vector Search")
+                                            && 
job.getJobName().contains("MULTI_VECTOR_PK_T"))
+                    .extracting(JobStatusMessage::getJobId)
+                    .hasSize(2)
+                    .doesNotHaveDuplicates();
+        }
+    }
+
     @Test
     public void testDistributedPrimaryKeyVectorSearchWithResidualFilter() {
         createPrimaryKeyVectorTableWithPayload(
diff --git 
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PrimaryKeyVectorSearchTest.scala
 
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PrimaryKeyVectorSearchTest.scala
index c020412b88..484b092ca2 100644
--- 
a/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PrimaryKeyVectorSearchTest.scala
+++ 
b/paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sql/PrimaryKeyVectorSearchTest.scala
@@ -21,7 +21,7 @@ package org.apache.paimon.spark.sql
 import org.apache.paimon.globalindex.testvector.TestVectorGlobalIndexerFactory
 import org.apache.paimon.spark.PaimonSparkTestBase
 import org.apache.paimon.spark.read.{SparkPrimaryKeyVectorRead, 
SparkVectorSearchBuilderImpl}
-import org.apache.paimon.table.source.DataSplit
+import org.apache.paimon.table.source.{BucketVectorSearchSplit, DataSplit, 
PrimaryKeyVectorResult}
 
 import scala.collection.JavaConverters._
 
@@ -111,6 +111,74 @@ class PrimaryKeyVectorSearchTest extends 
PaimonSparkTestBase {
     }
   }
 
+  test("distributed primary-key vector search isolates multiple indexed 
columns") {
+    withTable("T") {
+      val indexType = TestVectorGlobalIndexerFactory.IDENTIFIER
+      spark.sql(s"""
+                   |CREATE TABLE T (
+                   |  id INT, image_embedding ARRAY<FLOAT>, text_embedding 
ARRAY<FLOAT>
+                   |) TBLPROPERTIES (
+                   |  'primary-key' = 'id', 'bucket' = '2',
+                   |  'deletion-vectors.enabled' = 'true',
+                   |  'vector-field' = 'image_embedding,text_embedding',
+                   |  'field.image_embedding.vector-dim' = '2',
+                   |  'field.text_embedding.vector-dim' = '2',
+                   |  'pk-vector.index.columns' = 
'image_embedding,text_embedding',
+                   |  'fields.image_embedding.pk-vector.index.type' = 
'$indexType',
+                   |  'fields.text_embedding.pk-vector.index.type' = 
'$indexType',
+                   |  'fields.image_embedding.pk-vector.distance.metric' = 
'l2',
+                   |  'fields.text_embedding.pk-vector.distance.metric' = 'l2',
+                   |  'global-index.search-mode' = 'fast',
+                   |  'global-index.thread-num' = '1',
+                   |  'test.vector.dimension' = '2', 'test.vector.metric' = 
'l2'
+                   |)
+                   |""".stripMargin)
+      val values = (1 to 16)
+        .map(id => s"($id, array($id.0f, 0.0f), array(${17 - id}.0f, 0.0f))")
+        .mkString(",")
+      spark.sql(s"INSERT INTO T VALUES $values")
+      spark.sql("CALL sys.compact(table => 'T')")
+
+      Seq("image_embedding" -> Set(1, 2), "text_embedding" -> Set(15, 
16)).foreach {
+        case (column, expectedIds) =>
+          val table = loadTable("T")
+          val builder = new SparkVectorSearchBuilderImpl(table)
+          builder.withVectorColumn(column).withVector(Array(0.0f, 
0.0f)).withLimit(2)
+          val plan = builder.newVectorScan().scan()
+          val splits = 
plan.splits().asScala.map(_.asInstanceOf[BucketVectorSearchSplit])
+          assert(splits.map(_.dataSplit().bucket()).toSet == Set(0, 1))
+          assert(splits.forall(!_.payloadFiles().isEmpty))
+          val fieldId = table.rowType().getField(column).id()
+          assert(
+            splits
+              .flatMap(_.payloadFiles().asScala)
+              .forall(_.globalIndexMeta().indexFieldId() == fieldId))
+
+          val jobGroup = 
s"primary-key-multiple-vectors-$column-${System.nanoTime()}"
+          spark.sparkContext.setJobGroup(jobGroup, jobGroup)
+          try {
+            val result = 
builder.newVectorRead().read(plan).asInstanceOf[PrimaryKeyVectorResult]
+            assert(result.positions().size() == 2)
+          } finally {
+            spark.sparkContext.clearJobGroup()
+          }
+          
assert(spark.sparkContext.statusTracker.getJobIdsForGroup(jobGroup).nonEmpty)
+
+          withSparkSQLConf("spark.paimon.vector-search.distribute.enabled" -> 
"true") {
+            val ids = spark
+              .sql(s"""
+                      |SELECT id
+                      |FROM vector_search('T', '$column', array(0.0f, 0.0f), 2)
+                      |""".stripMargin)
+              .collect()
+              .map(_.getInt(0))
+              .toSet
+            assert(ids == expectedIds)
+          }
+      }
+    }
+  }
+
   test("postpone bucket builds primary-key vector index during compact") {
     withTable("T") {
       createVectorTable(

Reply via email to