avantgardnerio commented on code in PR #4112:
URL: https://github.com/apache/arrow-datafusion/pull/4112#discussion_r1014662039
##########
datafusion/core/src/execution/context.rs:
##########
@@ -2267,30 +2288,33 @@ mod tests {
let mut table_factories: HashMap<String, Arc<dyn
TableProviderFactory>> =
HashMap::new();
- table_factories.insert("test".to_string(), Arc::new(TestTableFactory
{}));
+ let factory = Arc::new(ListingTableFactory::new(FileType::CSV));
+ table_factories.insert("test".to_string(), factory);
let rt_cfg =
RuntimeConfig::new().with_table_factories(table_factories);
let runtime = Arc::new(RuntimeEnv::new(rt_cfg).unwrap());
let cfg = SessionConfig::new()
.set_str("datafusion.catalog.location", url.as_str())
.set_str("datafusion.catalog.type", "test");
let session_state = SessionState::with_config_rt(cfg, runtime);
let ctx = SessionContext::with_state(session_state);
+ ctx.refresh_catalogs().await?;
- let mut table_count = 0;
- for cat_name in ctx.catalog_names().iter() {
- let cat = ctx.catalog(cat_name).unwrap();
- for s_name in cat.schema_names().iter() {
- let schema = cat.schema(s_name).unwrap();
- if let Some(listing) =
- schema.as_any().downcast_ref::<ListingSchemaProvider>()
- {
- listing.refresh().await.unwrap();
- table_count = schema.table_names().len();
- }
- }
- }
+ let result =
+ plan_and_collect(&ctx, "select c_name from default.customer limit
3;")
+ .await?;
+
+ let actual = arrow::util::pretty::pretty_format_batches(&result)
+ .unwrap()
+ .to_string();
+ let expected = r#"+--------------------+
+| c_name |
++--------------------+
+| Customer#000000002 |
+| Customer#000000003 |
+| Customer#000000004 |
++--------------------+"#;
Review Comment:
The proof is in the pudding. Can't select from a table without registering
it first, so this must be auto-registered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]