Copilot commented on code in PR #23703: URL: https://github.com/apache/datafusion/pull/23703#discussion_r3624382409
########## docs/source/library-user-guide/upgrading/55.0.0.md: ########## @@ -776,3 +776,38 @@ async fn plan_extension( ``` See [PR #23649](https://github.com/apache/datafusion/pull/23649) for details. + +### Catalog traits moved to `datafusion-session` + +The catalog contract traits now live in the `datafusion-session` crate so they +can be reached without downcasting a `Session` to `SessionState` (in particular +across the FFI boundary). The affected traits are `CatalogProviderList`, +`CatalogProvider`, `SchemaProvider`, `TableProvider`, `TableProviderFactory`, +`TableFunction`, and `TableFunctionImpl`. Review Comment: `TableFunction` is a struct, not a trait, so calling it out as an “affected trait” is inaccurate and may confuse readers. Consider listing it separately as a related type, or remove it from the “traits” list. ########## datafusion/session/src/schema.rs: ########## @@ -0,0 +1,107 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! Describes the interface and built-in implementations of schemas, +//! representing collections of named tables. + +use async_trait::async_trait; +use datafusion_common::{DataFusionError, exec_err}; +use std::any::Any; +use std::fmt::Debug; +use std::sync::Arc; + +use crate::table::TableProvider; +use datafusion_common::Result; +use datafusion_expr::TableType; + +/// Represents a schema, comprising a number of named tables. +/// +/// Please see [`CatalogProvider`] for details of implementing a custom catalog. +/// +/// [`CatalogProvider`]: super::CatalogProvider +#[async_trait] +pub trait SchemaProvider: Any + Debug + Sync + Send { + /// Returns the owner of the Schema, default is None. This value is reported + /// as part of `information_tables.schemata + fn owner_name(&self) -> Option<&str> { Review Comment: Doc comment has a typo and an unclosed code span: `information_tables.schemata` should be `information_schema.schemata` and the backtick needs to be closed. ########## docs/source/library-user-guide/upgrading/55.0.0.md: ########## @@ -776,3 +776,38 @@ async fn plan_extension( ``` See [PR #23649](https://github.com/apache/datafusion/pull/23649) for details. + +### Catalog traits moved to `datafusion-session` + +The catalog contract traits now live in the `datafusion-session` crate so they +can be reached without downcasting a `Session` to `SessionState` (in particular +across the FFI boundary). The affected traits are `CatalogProviderList`, +`CatalogProvider`, `SchemaProvider`, `TableProvider`, `TableProviderFactory`, +`TableFunction`, and `TableFunctionImpl`. + +The `datafusion-catalog` crate re-exports all of them from their new location, +so paths such as `datafusion::catalog::TableProvider` and +`datafusion_catalog::CatalogProvider` continue to work unchanged. Most users do +not need to do anything. + +### `Session` gains a required `catalog_list` method + +The `Session` trait now requires a `catalog_list` method that returns the +catalogs registered with the session: + +```rust +fn catalog_list(&self) -> Arc<dyn CatalogProviderList>; +``` + +Custom `Session` implementations must add this method. Implementations that do +not expose a catalog can return the new `EmptyCatalogProviderList`: + +```rust +use datafusion_session::EmptyCatalogProviderList; Review Comment: The `catalog_list` snippet is missing imports for `Arc` and `CatalogProviderList`, so it won’t compile if copied verbatim. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
