luoyuxia commented on code in PR #205:
URL: https://github.com/apache/paimon-rust/pull/205#discussion_r3036716673
##########
crates/paimon/src/table/table_scan.rs:
##########
@@ -691,8 +691,14 @@ impl<'a> TableScan<'a> {
}
}
- // Apply limit pushdown to reduce the number of splits if possible
- let splits = self.apply_limit_pushdown(splits);
+ // Apply limit pushdown only when there are no data predicates.
+ // With data predicates, merged_row_count() reflects pre-filter row
counts,
+ // so stopping early could return fewer rows than the limit after
filtering.
+ let splits = if data_predicates.is_empty() {
Review Comment:
Thanks. Then, I think we should also remove this limit logic in
`crates/integrations/datafusion/src/physical_plan/scan.rs`
```
// Enforce the final LIMIT at the DataFusion execution layer.
let limited_stream: Pin<Box<dyn Stream<Item = DFResult<RecordBatch>>
+ Send>> =
if let Some(limit) = limit {
let mut remaining = limit;
Box::pin(stream.try_filter_map(move |batch| {
futures::future::ready(if remaining == 0 {
Ok(None)
} else if batch.num_rows() <= remaining {
remaining -= batch.num_rows();
Ok(Some(batch))
} else {
let limited_batch = batch.slice(0, remaining);
remaining = 0;
Ok(Some(limited_batch))
})
}))
} else {
Box::pin(stream)
};
Ok(Box::pin(RecordBatchStreamAdapter::new(
self.schema(),
limited_stream,
)))
```
--
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]