MCPcopy Create free account
hub / github.com/apache/datafusion / test_basic_table_scan

Function test_basic_table_scan

datafusion/core/src/datasource/listing/table.rs:1458–1488  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1456
1457 #[tokio::test]
1458 async fn test_basic_table_scan() -> Result<()> {
1459 let ctx = SessionContext::new();
1460
1461 // Test basic table creation and scanning
1462 let path = "table/file.json";
1463 register_test_store(&ctx, &[(path, 10)]);
1464
1465 let format = JsonFormat::default();
1466 let opt = ListingOptions::new(Arc::new(format)).with_collect_stat(false);
1467 let schema = Schema::new(vec![Field::new("a", DataType::Boolean, false)]);
1468 let table_path = ListingTableUrl::parse("test:///table/")?;
1469
1470 let config = ListingTableConfig::new(table_path)
1471 .with_listing_options(opt)
1472 .with_schema(Arc::new(schema));
1473
1474 let table = ListingTable::try_new(config)?;
1475
1476 // The scan should work correctly
1477 let scan_result = table.scan(&ctx.state(), None, &[], None).await;
1478 assert!(scan_result.is_ok(), "Scan should succeed");
1479
1480 // Verify file listing works
1481 let result = table.list_files_for_scan(&ctx.state(), &[], None).await?;
1482 assert!(
1483 !result.file_groups.is_empty(),
1484 "Should list files successfully"
1485 );
1486
1487 Ok(())
1488 }
1489}

Callers

nothing calls this directly

Calls 8

newFunction · 0.85
register_test_storeFunction · 0.85
with_collect_statMethod · 0.80
with_listing_optionsMethod · 0.80
list_files_for_scanMethod · 0.80
with_schemaMethod · 0.45
scanMethod · 0.45
stateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…