(
&self,
ctx: &SessionContext,
table: &str,
)
| 242 | } |
| 243 | |
| 244 | async fn get_table( |
| 245 | &self, |
| 246 | ctx: &SessionContext, |
| 247 | table: &str, |
| 248 | ) -> Result<Arc<dyn TableProvider>> { |
| 249 | let path = self.path.to_str().unwrap(); |
| 250 | let state = ctx.state(); |
| 251 | let path = format!("{path}/{table}"); |
| 252 | let format = Arc::new( |
| 253 | ParquetFormat::default() |
| 254 | .with_options(ctx.state().table_options().parquet.clone()), |
| 255 | ); |
| 256 | let extension = DEFAULT_PARQUET_EXTENSION; |
| 257 | |
| 258 | let options = ListingOptions::new(format) |
| 259 | .with_file_extension(extension) |
| 260 | .with_collect_stat(true); // Always collect statistics for sort pushdown |
| 261 | |
| 262 | let table_path = ListingTableUrl::parse(path)?; |
| 263 | let schema = options.infer_schema(&state, &table_path).await?; |
| 264 | let options = if self.sorted { |
| 265 | let key_column_name = schema.fields()[0].name(); |
| 266 | options |
| 267 | .with_file_sort_order(vec![vec![col(key_column_name).sort(true, false)]]) |
| 268 | } else { |
| 269 | options |
| 270 | }; |
| 271 | |
| 272 | let config = ListingTableConfig::new(table_path) |
| 273 | .with_listing_options(options) |
| 274 | .with_schema(schema); |
| 275 | |
| 276 | Ok(Arc::new(ListingTable::try_new(config)?.with_cache( |
| 277 | ctx.runtime_env().cache_manager.get_file_statistic_cache(), |
| 278 | ))) |
| 279 | } |
| 280 | |
| 281 | fn iterations(&self) -> usize { |
| 282 | self.common.iterations |
no test coverage detected