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


##########
crates/paimon/src/table/table_scan/file_scan.rs:
##########
@@ -201,6 +201,7 @@ impl PaimonTableScan<'_> {
             self.table.schema().fields(),
             &self.table.schema().trimmed_primary_keys(),
             bucket_selector.as_ref(),
+            self.selected_bucket(),

Review Comment:
   `plan_files()` clears `scan.split_selection` before reaching this call, so 
`self.selected_bucket()` is always `None` here. On a table with one file in 
bucket 1 and one in bucket 3, I called `with_bucket(3)`. `plan()` returned 
bucket IDs `[3]`, and `plan_files()` returned `[1, 3]` (expected `[3]`). A 
worker using the file plan can therefore process files assigned to another 
bucket.
   
   Please preserve the physical bucket selection when clearing split 
distribution settings in `plan_files()`. Add a two-bucket regression test that 
checks the buckets returned by `with_bucket(3).plan_files()`.



##########
crates/paimon/src/table/table_scan.rs:
##########
@@ -413,7 +419,11 @@ async fn read_all_manifest_entries(
         .await?;
     let mut all_entries = if incremental {
         validate_incremental_entries(&all_entries)?;
-        all_entries
+        let mut entries = all_entries;
+        if let Some(bucket) = selected_bucket {
+            entries.retain(|entry| entry.bucket() == bucket);

Review Comment:
   This filter removes entries from other buckets without updating 
`manifest_entries_pruned_by_bucket`. I reproduced this with a timestamp-window 
incremental scan covering an append with one file in bucket 1 and one in bucket 
3. With `with_bucket(3)`, the plan returned only bucket 3 and reported 
`manifest_entries_read = 2` and `manifest_entries_pruned_by_bucket = 0` 
(expected `1`). This makes `bucket_pruned` in the planning diagnostics 
undercount the entries removed by bucket selection.
   
   Please keep the filter after DELETE validation and add the difference in 
entry count before and after `retain` to `counters.pruned_by_bucket`. The same 
incremental test can assert both the selected bucket and the counter.



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