wwj6591812 commented on code in PR #8116:
URL: https://github.com/apache/paimon/pull/8116#discussion_r3524186688


##########
paimon-core/src/main/java/org/apache/paimon/table/source/KeyValueTableRead.java:
##########
@@ -152,6 +178,33 @@ public RecordReader<InternalRow> reader(Split split) 
throws IOException {
         throw new RuntimeException("Should not happen.");
     }
 
+    private static boolean hasLateAppliedRowFilter(Split split) {
+        if (split instanceof QueryAuthSplit) {
+            TableQueryAuthResult authResult = ((QueryAuthSplit) 
split).authResult();
+            return authResult != null && authResult.extractPredicate() != null;
+        }
+        return false;
+    }
+
+    private boolean needsTableLevelLimit(Split split) {
+        if (limit == null || limit <= 0) {
+            return false;
+        }
+        if (hasLateAppliedRowFilter(split)) {
+            return true;
+        }
+        return !isMergeReadLimitActive(split);
+    }
+
+    private boolean isMergeReadLimitActive(Split split) {

Review Comment:
   Thanks for the suggestion. 
   
   I simplified this part and removed the `isMergeReadLimitActive` plumbing 
from `SplitRead` / `KeyValueTableRead`. 
   
   Now `KeyValueTableRead` always keeps a table-level `LimitRecordReader` as 
the semantic limit guard, while `MergeFileSplitRead` still applies the 
read-side limit internally only when it is safe. For row-filtering 
`QueryAuthSplit`, I still disable the lower-level limit during reader creation 
and apply the table-level limit after auth filtering, because that filter is 
applied after the split reader. The related limit regression tests pass.



-- 
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