Generate a partitioned CSV file and register it with an execution context
(
tmp_dir: &TempDir,
partition_count: usize,
)
| 155 | |
| 156 | /// Generate a partitioned CSV file and register it with an execution context |
| 157 | async fn create_ctx_with_partition( |
| 158 | tmp_dir: &TempDir, |
| 159 | partition_count: usize, |
| 160 | ) -> Result<SessionContext> { |
| 161 | let ctx = |
| 162 | SessionContext::new_with_config(SessionConfig::new().with_target_partitions(8)); |
| 163 | |
| 164 | let schema = populate_csv_partitions(tmp_dir, partition_count, ".csv")?; |
| 165 | |
| 166 | // register csv file with the execution context |
| 167 | ctx.register_csv( |
| 168 | "test", |
| 169 | tmp_dir.path().to_str().unwrap(), |
| 170 | CsvReadOptions::new().schema(&schema), |
| 171 | ) |
| 172 | .await?; |
| 173 | |
| 174 | Ok(ctx) |
| 175 | } |
| 176 | |
| 177 | /// Generate CSV partitions within the supplied directory |
| 178 | fn populate_csv_partitions( |
no test coverage detected
searching dependent graphs…