Skip to content

Commit

Permalink
Address clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
westonpace committed Nov 27, 2024
1 parent 840e4ed commit 0f58fac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ impl SessionContext {
let (name, catalog_list) = {
let state = self.state.read();
let name = state.config().options().catalog.default_catalog.clone();
let catalog_list = state.catalog_list().clone();
let catalog_list = Arc::clone(state.catalog_list());
(name, catalog_list)
};
let catalog_fut = catalog_list.catalog(&name);
Expand Down Expand Up @@ -962,7 +962,7 @@ impl SessionContext {
(true, Some(_)) => self.return_empty_dataframe(),
(true, None) | (false, None) => {
let new_catalog = Arc::new(MemoryCatalogProvider::new());
let catalog_list = self.state.write().catalog_list().clone();
let catalog_list = Arc::clone(self.state.write().catalog_list());
catalog_list
.register_catalog(catalog_name, new_catalog)
.await?;
Expand Down Expand Up @@ -1016,7 +1016,7 @@ impl SessionContext {
state.config_options().catalog.default_catalog.to_string()
}
};
let catalog_list = state.catalog_list().clone();
let catalog_list = Arc::clone(state.catalog_list());
(catalog_name, catalog_list)
};
if let Some(catalog) = catalog_list.catalog(&catalog_name).await? {
Expand Down Expand Up @@ -1084,7 +1084,7 @@ impl SessionContext {
let (resolved, catalog_list) = {
let state = self.state.read();
let resolved = state.resolve_table_ref(table_ref);
let catalog_list = state.catalog_list().clone();
let catalog_list = Arc::clone(state.catalog_list());
(resolved, catalog_list)
};
if let Some(catalog) = catalog_list.catalog(&resolved.catalog).await? {
Expand Down Expand Up @@ -1444,20 +1444,20 @@ impl SessionContext {
catalog: Arc<dyn CatalogProvider>,
) -> Result<Option<Arc<dyn CatalogProvider>>> {
let name = name.into();
let catalog_list = self.state.read().catalog_list().clone();
let catalog_list = Arc::clone(self.state.read().catalog_list());
catalog_list.register_catalog(name, catalog).await
}

/// Retrieves the list of available catalog names.
pub async fn catalog_names(&self) -> BoxStream<'static, Result<String>> {
let catalog_list = self.state.read().catalog_list().clone();
let catalog_list = Arc::clone(self.state.read().catalog_list());
catalog_list.catalog_names().await
}

/// Retrieves a [`CatalogProvider`] instance by name
pub async fn catalog(&self, name: &str) -> Result<Option<Arc<dyn CatalogProvider>>> {
let catalog_list = self.state.read().catalog_list().clone();
Ok(catalog_list.catalog(name).await?)
let catalog_list = Arc::clone(self.state.read().catalog_list());
catalog_list.catalog(name).await
}

/// Registers a [`TableProvider`] as a table that can be
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/execution/session_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ impl SessionState {
table_ref: impl Into<TableReference>,
) -> BoxFuture<'static, datafusion_common::Result<Arc<dyn SchemaProvider>>> {
let resolved_ref = self.resolve_table_ref(table_ref);
let catalog_list = self.catalog_list.clone();
let catalog_list = Arc::clone(&self.catalog_list);
if self.config.information_schema() && *resolved_ref.schema == *INFORMATION_SCHEMA
{
return std::future::ready(Ok(Arc::new(InformationSchemaProvider::new(
Expand Down

0 comments on commit 0f58fac

Please sign in to comment.