Returns a new `DataFrame` with a limited number of rows. # Arguments `skip` - Number of rows to skip before fetch any row `fetch` - Maximum number of rows to return, after skipping `skip` rows. # Example ``` # use datafusion::prelude::*; # use datafusion::error::Result; # use datafusion_common::assert_batches_sorted_eq; # #[tokio::main] # async fn main() -> Result<()> { let ctx = SessionContext:
(self, skip: usize, fetch: Option<usize>)
| 722 | /// # } |
| 723 | /// ``` |
| 724 | pub fn limit(self, skip: usize, fetch: Option<usize>) -> Result<DataFrame> { |
| 725 | let plan = LogicalPlanBuilder::from(self.plan) |
| 726 | .limit(skip, fetch)? |
| 727 | .build()?; |
| 728 | Ok(DataFrame { |
| 729 | session_state: self.session_state, |
| 730 | plan, |
| 731 | projection_requires_validation: self.projection_requires_validation, |
| 732 | }) |
| 733 | } |
| 734 | |
| 735 | /// Calculate the union of two [`DataFrame`]s, preserving duplicate rows. |
| 736 | /// |