alamb commented on code in PR #7772:
URL: https://github.com/apache/arrow-datafusion/pull/7772#discussion_r1367715835
##########
datafusion/core/tests/fuzz_cases/sort_fuzz.rs:
##########
@@ -138,6 +154,44 @@ impl SortTest {
self
}
+ async fn run_with_limit<'a>(
+ &self,
+ topk_scenario: &TopKScenario<'a>,
+ ) -> Vec<RecordBatch> {
+ let input = self.input.clone();
+ let schema = input
+ .iter()
+ .flat_map(|p| p.iter())
+ .next()
+ .expect("at least one batch")
+ .schema();
+
+ let table = MemTable::try_new(schema, input.clone()).unwrap();
+
+ let ctx = SessionContext::new();
+
+ ctx.register_table(
+ TableReference::Bare {
+ table: topk_scenario.table_name.into(),
+ },
+ Arc::new(table),
+ )
+ .unwrap();
+
+ let df = ctx
+ .table(topk_scenario.table_name)
+ .await
+ .unwrap()
+ .sort(vec![
+ datafusion_expr::col(topk_scenario.col_name).sort(true, true)
+ ])
+ .unwrap()
+ .limit(0, Some(topk_scenario.limit))
Review Comment:
I verified the plan here has the expected `TopK` element:
```
| physical_plan |
GlobalLimitExec: skip=0, fetch=10 |
| | SortExec:
TopK(fetch=10), expr=[x@0 ASC] |
| |
MemoryExec: partitions=1, partition_sizes=[38] |
```
--
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]