JingsongLi commented on code in PR #8399:
URL: https://github.com/apache/paimon/pull/8399#discussion_r3520116616


##########
paimon-common/src/main/java/org/apache/paimon/predicate/FieldRef.java:
##########
@@ -64,6 +79,38 @@ public DataType type() {
         return type;
     }
 
+    @JsonProperty(FIELD_NESTED_INDEXES)
+    @Nullable
+    public int[] nestedIndexes() {
+        return nestedIndexes;
+    }
+
+    @JsonProperty(FIELD_NESTED_ARITIES)
+    @Nullable
+    public int[] nestedArities() {
+        return nestedArities;
+    }
+
+    /**
+     * Returns a copy of this ref with the given top-level index, preserving 
name, type and nested
+     * path metadata.
+     */
+    public FieldRef withIndex(int newIndex) {
+        return new FieldRef(newIndex, name, type, nestedIndexes, 
nestedArities);
+    }
+
+    /**
+     * Returns the name of the top-level field this ref points at: {@link 
#name()} for a top-level
+     * ref, the first path segment for a nested ref (whose name is the full 
dotted path).
+     */
+    public String topLevelName() {

Review Comment:
   This new helper also needs to be reflected in the field-name collection 
paths. `PredicateVisitor.collectFieldNames()` still collects `ref.name()`, 
which is now the full nested path (`s.b`) for these Spark predicates. One 
concrete fallout is `AbstractDataTableRead.authedReader`: when a user projects 
only `id` but the auth row filter references `s.b`, the pre-read expansion 
checks the collected names against top-level table fields, does not add `s`, 
and `TableQueryAuthResult` then rejects the filter because the output row type 
lacks the top-level `s` column. Please either make the collector return 
top-level names for `FieldRef`s (or add/use a top-level collector at those call 
sites) and add a regression where auth filtering on a nested field works even 
when the user projection excludes that top-level field.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to