()
| 372 | |
| 373 | #[tokio::test] |
| 374 | async fn read_empty_table() -> Result<()> { |
| 375 | let ctx = SessionContext::new(); |
| 376 | let path = String::from("table/p1=v1/file.json"); |
| 377 | register_test_store(&ctx, &[(&path, 100)]); |
| 378 | |
| 379 | let format = JsonFormat::default(); |
| 380 | let ext = format.get_ext(); |
| 381 | |
| 382 | let opt = ListingOptions::new(Arc::new(format)) |
| 383 | .with_file_extension(ext) |
| 384 | .with_table_partition_cols(vec![(String::from("p1"), DataType::Utf8)]) |
| 385 | .with_target_partitions(4); |
| 386 | |
| 387 | let table_path = ListingTableUrl::parse("test:///table/")?; |
| 388 | let file_schema = |
| 389 | Arc::new(Schema::new(vec![Field::new("a", DataType::Boolean, false)])); |
| 390 | let config = ListingTableConfig::new(table_path) |
| 391 | .with_listing_options(opt) |
| 392 | .with_schema(file_schema); |
| 393 | let table = ListingTable::try_new(config)?; |
| 394 | |
| 395 | assert_eq!( |
| 396 | columns(&table.schema()), |
| 397 | vec!["a".to_owned(), "p1".to_owned()] |
| 398 | ); |
| 399 | |
| 400 | // this will filter out the only file in the store |
| 401 | let filter = Expr::not_eq(col("p1"), lit("v1")); |
| 402 | |
| 403 | let scan = table |
| 404 | .scan(&ctx.state(), None, &[filter], None) |
| 405 | .await |
| 406 | .expect("Empty execution plan"); |
| 407 | |
| 408 | assert!(scan.is::<EmptyExec>()); |
| 409 | assert_eq!( |
| 410 | columns(&scan.schema()), |
| 411 | vec!["a".to_owned(), "p1".to_owned()] |
| 412 | ); |
| 413 | |
| 414 | Ok(()) |
| 415 | } |
| 416 | |
| 417 | async fn load_table( |
| 418 | ctx: &SessionContext, |
nothing calls this directly
no test coverage detected
searching dependent graphs…