()
| 858 | |
| 859 | #[tokio::test] |
| 860 | async fn exec_with_limit() -> Result<()> { |
| 861 | let task_ctx = Arc::new(TaskContext::default()); |
| 862 | let batch = make_partition(7); |
| 863 | let schema = batch.schema(); |
| 864 | let batches = vec![batch.clone(), batch]; |
| 865 | |
| 866 | let exec = MemorySourceConfig::try_new_from_batches(schema, batches).unwrap(); |
| 867 | assert_eq!(exec.fetch(), None); |
| 868 | |
| 869 | let exec = exec.with_fetch(Some(4)).unwrap(); |
| 870 | assert_eq!(exec.fetch(), Some(4)); |
| 871 | |
| 872 | let mut it = exec.execute(0, task_ctx)?; |
| 873 | let mut results = vec![]; |
| 874 | while let Some(batch) = it.next().await { |
| 875 | results.push(batch?); |
| 876 | } |
| 877 | |
| 878 | let expected = [ |
| 879 | "+---+", "| i |", "+---+", "| 0 |", "| 1 |", "| 2 |", "| 3 |", "+---+", |
| 880 | ]; |
| 881 | assert_batches_eq!(expected, &results); |
| 882 | Ok(()) |
| 883 | } |
| 884 | |
| 885 | /// Test that `try_swapping_with_projection` preserves the `fetch` limit. |
| 886 | /// Regression test for <https://github.com/apache/datafusion/issues/21176> |
nothing calls this directly
no test coverage detected
searching dependent graphs…