github-actions[bot] commented on code in PR #66711:
URL: https://github.com/apache/doris/pull/66711#discussion_r3780705722


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/FileQueryScanNode.java:
##########
@@ -492,7 +504,31 @@ public void createScanRangeLocations() throws 
UserException {
         }
     }
 
-    private TScanRangeLocations splitToScanRange(
+    protected boolean supportsPerRangeFileAffinity() {
+        return false;
+    }
+
+    @Override
+    public List<List<Integer>> splitScanRangeParamsByInstance(
+            List<TScanRangeParams> scanRangeParams, int expectedInstanceNum) {
+        return AffinityAwareInstanceSplitter.split(scanRangeParams, 
expectedInstanceNum,
+                param -> 
Optional.ofNullable(scanRangeToFileAffinityKey.get(param.getScanRange())),
+                this::getScanRangeSize);
+    }
+
+    private long getScanRangeSize(TScanRangeParams param) {
+        long size = 0;
+        for (TFileRangeDesc range : 
param.getScanRange().getExtScanRange().getFileScanRange().getRanges()) {

Review Comment:
   [P1] Handle split-source-only ranges before weighing them
   
   The batch branch intentionally creates `TFileScanRange` values with only 
`split_source`; `ranges` is optional and remains unset. However, 
`AffinityAwareInstanceSplitter.split()` evaluates this weight function for 
every item before it checks whether any affinity key exists, so a lazy/batch 
scan reaches this enhanced-for with `getRanges() == null` and fails during 
instance planning in both the legacy and Nereids paths—even though backend 
affinity is disabled for batch mode. Please short-circuit to the old 
no-affinity split before evaluating weights and/or treat an unset range list as 
zero, and add a split-source-only regression.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to