924060929 commented on code in PR #66473:
URL: https://github.com/apache/doris/pull/66473#discussion_r3781664950


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java:
##########
@@ -320,8 +324,29 @@ private void 
getFileSplitByPartitions(HiveExternalMetaCache cache, List<HivePart
             }
         } else {
             boolean withCache = Config.max_external_file_cache_num > 0;
-            fileCaches = cache.getFilesByPartitions(partitions, withCache, 
partitions.size() > 1,
-                    directoryLister, hmsTable);
+            if (isBatchMode || !withCache) {
+                // Batch mode bounds FE memory by retaining only the 
partitions currently in flight.
+                // Keeping every completed partition in the statement cache 
would materialize the
+                // full scan again and defeat that bound. When the global file 
cache is disabled,
+                // statement retention must not become an uncapped replacement 
for that memory fence.
+                fileCaches = cache.getFilesByPartitions(partitions, withCache, 
partitions.size() > 1,
+                        directoryLister, hmsTable);
+            } else {
+                HiveFileScanTaskCacheKey cacheKey = new 
HiveFileScanTaskCacheKey(

Review Comment:
   Fixed the remaining invalidation ordering in bf6a412a737. Every relevant 
Hive path now removes the old global file entry first and advances the catalog 
generation only after that removal completes. A concurrent alias may still 
capture G while invalidation is running, but it cannot retain an old entry 
under G+1; aliases after invalidation observe G+1.  uses latches inside the 
file-key predicate to prove the generation remains G until the old entry is 
removed, then advances to G+1. The focused 3-test class and full 4.1 FE build 
passed.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/hudi/source/HudiScanNode.java:
##########
@@ -380,29 +385,68 @@ private List<HivePartition> 
getPrunedPartitions(HoodieTableMetaClient metaClient
 
     private List<Split> getIncrementalSplits() {
         long startTime = System.currentTimeMillis();
-        if (canUseNativeReader()) {
-            List<Split> splits = incrementalRelation.collectSplits();
-            noLogsSplitNum.addAndGet(splits.size());
+        try {
+            if (canUseNativeReader()) {
+                List<Split> splits = incrementalRelation.collectSplits();
+                noLogsSplitNum.addAndGet(splits.size());
+                return splits;
+            }
+            Option<String[]> partitionColumns = 
hudiClient.getTableConfig().getPartitionFields();
+            List<String> partitionNames = partitionColumns.isPresent()
+                    ? Arrays.asList(partitionColumns.get()) : 
Collections.emptyList();
+            List<Split> splits = 
incrementalRelation.collectFileSlices().stream()
+                    .map(fileSlice -> generateHudiSplit(fileSlice,
+                            HudiPartitionUtils.parsePartitionValues(
+                                    partitionNames, 
fileSlice.getPartitionPath()),
+                            incrementalRelation.getEndTs()))
+                    .collect(Collectors.toList());
+            if (!sessionVariable.isForceJniScanner()) {
+                splits.stream()
+                        .map(split -> (HudiSplit) split)
+                        .filter(split -> split.getHudiDeltaLogs().isEmpty())
+                        .forEach(split -> noLogsSplitNum.incrementAndGet());
+            }
+            return splits;
+        } finally {
             if (getSummaryProfile() != null) {
                 
getSummaryProfile().addExternalTableGetFileScanTasksTime(System.currentTimeMillis()
 - startTime);
             }
-            return splits;
         }
-        Option<String[]> partitionColumns = 
hudiClient.getTableConfig().getPartitionFields();
-        List<String> partitionNames = partitionColumns.isPresent() ? 
Arrays.asList(partitionColumns.get())
-                : Collections.emptyList();
-        List<Split> splits = incrementalRelation.collectFileSlices().stream()
-                .map(fileSlice -> generateHudiSplit(fileSlice,
-                        
HudiPartitionUtils.parsePartitionValues(partitionNames, 
fileSlice.getPartitionPath()),
-                        incrementalRelation.getEndTs()))
-                .collect(Collectors.toList());
-        if (getSummaryProfile() != null) {
-            
getSummaryProfile().addExternalTableGetFileScanTasksTime(System.currentTimeMillis()
 - startTime);
+    }
+
+    private void getPartitionSplits(HivePartition partition, List<Split> 
splits) throws Exception {
+        getPartitionSplits(partition, splits, true);
+    }
+
+    private void getPartitionSplits(

Review Comment:
   Extended the Hudi fix in bf6a412a737 for the continuation noted on this 
thread. The scan node now freezes the ordered HMS partition-column names from 
the same relation snapshot, uses that exact list when constructing 
runtime-pruned split partition maps, and includes an immutable copy in the 
reuse key's equality/hash. Thus a metadata-only refresh that changes 
SerDe/schema fields or ordered partition names cannot reuse splits embedding 
the previous generation.  covers both SerDe and reordered partition-column 
separation with runtime pruning enabled; all 8 Hudi tests passed.



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