JingsongLi commented on code in PR #1508:
URL: https://github.com/apache/paimon-rust/pull/1508#discussion_r4674450182


##########
crates/paimon/src/table/read_execution.rs:
##########
@@ -132,8 +153,50 @@ pub(super) fn execute(
                 }
             }) as ArrowRecordBatchStream
         })
-        .collect();
-    merge_streams(streams, ordered, limit)
+        .collect::<Vec<_>>();
+    match (blob_output_budget, costs) {
+        (Some(budget), Some(costs)) if streams.len() > 1 => {
+            let permits = budget_permits(budget.max_bytes) as usize;
+            merge_streams_budgeted(streams, costs, permits, ordered)
+        }
+        _ => merge_streams(streams, ordered, limit),
+    }
+}
+
+/// Estimate decoded bytes from managed BLOB files; serialize unknown sources.
+fn blob_group_cost(group: &[DataSplit], budget: &BlobOutputBudget) -> u32 {
+    let permits = budget_permits(budget.max_bytes);
+    if budget.unknown_external {
+        return permits;
+    }
+    let file_bytes = group
+        .iter()
+        .map(|split| {
+            let mut bytes = 0_u64;
+            let mut unknown = false;
+            for file in split.data_files() {
+                if file.file_name.ends_with(".blob") {
+                    bytes = 
bytes.saturating_add(u64::try_from(file.file_size).unwrap_or(0));
+                } else if file
+                    .write_cols
+                    .as_ref()
+                    .is_none_or(|cols| cols.iter().any(|col| 
budget.fields.contains(col)))
+                {
+                    unknown = true;
+                }
+            }
+            if unknown || bytes == 0 {
+                budget.max_bytes

Review Comment:
   **[P1] Preserve split concurrency for ordinary managed primary-key BLOBs**
   
   Every normal PK Parquet file has `write_cols = None`, and its managed BLOBs 
are referenced through the sidecar rather than listed as `.blob` entries in the 
split. This fallback therefore assigns every group the full budget, even for 
tiny native BLOBs. I wrote 5- and 6-byte values to two PK partitions, then 
delayed the first Parquet read using `FileBlockCache`. With `parallelism=2` and 
the default budget, the second split opened independently on `main`. On this 
head it only started after the first was released. The existing parallel read 
setting becomes ineffective for this path, which can amplify object-storage 
latency across partitions. Keep split preparation concurrent and reserve bytes 
when the decoded descriptors expose their lengths, or make the serialized 
fallback opt-in until it has representative throughput coverage.



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