You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/06/03 11:10:57 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6536: fix: ignore panics if racing against catalog/schema changes

alamb commented on code in PR #6536:
URL: https://github.com/apache/arrow-datafusion/pull/6536#discussion_r1215437000


##########
datafusion/core/src/catalog/information_schema.rs:
##########
@@ -81,15 +81,17 @@ impl InformationSchemaConfig {
 
             for schema_name in catalog.schema_names() {
                 if schema_name != INFORMATION_SCHEMA {
-                    let schema = catalog.schema(&schema_name).unwrap();
-                    for table_name in schema.table_names() {
-                        let table = schema.table(&table_name).await.unwrap();
-                        builder.add_table(
-                            &catalog_name,
-                            &schema_name,
-                            &table_name,
-                            table.table_type(),
-                        );
+                    // schema name may not exist in the catalog, so we need to check
+                    if let Some(schema) = catalog.schema(&schema_name) {
+                        for table_name in schema.table_names() {
+                            let table = schema.table(&table_name).await.unwrap();
+                            builder.add_table(

Review Comment:
   What do you think about applying the same change to `table(..).unwrap()` here and the other places below? 
   
   I think as written the code will still be subject to race conditions (if tables are removed from `Schema`s)
   
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org