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 bbac1b6912 [core] Improve file index option validation message (#8194)
bbac1b6912 is described below

commit bbac1b691281daef2e987cd99fd0ddcd5ac8300d
Author: LsomeYeah <[email protected]>
AuthorDate: Wed Jun 10 21:13:32 2026 +0800

    [core] Improve file index option validation message (#8194)
---
 .../apache/paimon/fileindex/FileIndexOptions.java  | 41 +++++++++++++++-------
 .../apache/paimon/schema/SchemaValidationTest.java | 16 +++++++++
 2 files changed, 44 insertions(+), 13 deletions(-)

diff --git 
a/paimon-api/src/main/java/org/apache/paimon/fileindex/FileIndexOptions.java 
b/paimon-api/src/main/java/org/apache/paimon/fileindex/FileIndexOptions.java
index 81002c2916..4dd34dbadc 100644
--- a/paimon-api/src/main/java/org/apache/paimon/fileindex/FileIndexOptions.java
+++ b/paimon-api/src/main/java/org/apache/paimon/fileindex/FileIndexOptions.java
@@ -22,6 +22,8 @@ import org.apache.paimon.CoreOptions;
 import org.apache.paimon.options.Options;
 import org.apache.paimon.utils.StringUtils;
 
+import javax.annotation.Nullable;
+
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
@@ -97,21 +99,27 @@ public class FileIndexOptions {
             String opkey = kv[2];
 
             // if reaches here, must be an option.
-            if (get(cname, indexType) != null) {
-                get(cname, indexType).set(opkey, optionEntry.getValue());
-            } else if (getMapTopLevelOptions(cname, indexType) != null) {
-                getMapTopLevelOptions(cname, indexType).set(opkey, 
optionEntry.getValue());
+            Options indexOptions = get(cname, indexType);
+            if (indexOptions == null) {
+                indexOptions = getMapTopLevelOptionsOrNull(cname, indexType);
+            }
+            if (indexOptions != null) {
+                indexOptions.set(opkey, optionEntry.getValue());
             } else {
                 throw new IllegalArgumentException(
-                        "Wrong option in \""
-                                + key
-                                + "\", can't found column \""
-                                + cname
-                                + "\" in \""
-                                + fileIndexPrefix
-                                + indexType
-                                + fileIndexColumnSuffix
-                                + "\"");
+                        String.format(
+                                "Wrong file index option '%s': column '%s' is 
not declared in '%s%s%s'. "
+                                        + "Please add '%s%s%s' = '%s' before 
setting column options. "
+                                        + "For map nested index, declare it 
like '<map-column>[<map-key>]'.",
+                                key,
+                                cname,
+                                fileIndexPrefix,
+                                indexType,
+                                fileIndexColumnSuffix,
+                                fileIndexPrefix,
+                                indexType,
+                                fileIndexColumnSuffix,
+                                cname));
             }
         }
     }
@@ -155,6 +163,13 @@ public class FileIndexOptions {
                 .orElse(null);
     }
 
+    @Nullable
+    private Options getMapTopLevelOptionsOrNull(String column, String 
indexType) {
+        return Optional.ofNullable(topLevelMapColumnOptions.getOrDefault(new 
Column(column), null))
+                .map(x -> x.get(indexType))
+                .orElse(null);
+    }
+
     public Options getMapTopLevelOptions(String column, String indexType) {
         return Optional.ofNullable(topLevelMapColumnOptions.getOrDefault(new 
Column(column), null))
                 .map(x -> x.get(indexType))
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java 
b/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java
index f40fec52fb..a306adc670 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/schema/SchemaValidationTest.java
@@ -422,6 +422,22 @@ class SchemaValidationTest {
         }
     }
 
+    @Test
+    public void testFileIndexColumnOptionWithoutColumnsDeclaration() {
+        Map<String, String> options = new HashMap<>();
+        options.put("file-index.bloom-filter.vin.items", "2000");
+        options.put("file-index.bloom-filter.vin.fpp", "0.0001");
+
+        assertThatThrownBy(() -> validateTableSchemaExec(options))
+                .isInstanceOf(IllegalArgumentException.class)
+                .hasMessageContaining("Wrong file index option 
'file-index.bloom-filter.vin.")
+                .hasMessageContaining(
+                        "column 'vin' is not declared in 
'file-index.bloom-filter.columns'")
+                .hasMessageContaining("Please add 
'file-index.bloom-filter.columns' = 'vin'")
+                .hasMessageContaining(
+                        "For map nested index, declare it like 
'<map-column>[<map-key>]'");
+    }
+
     @Test
     public void testFileIndexNestedColumn() {
         List<String> keys =

Reply via email to