Skip to content

Move catalog_common out of core #15193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions datafusion/catalog/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ datafusion-sql = { workspace = true }
futures = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
object_store = { workspace = true }
parking_lot = { workspace = true }

[dev-dependencies]
Expand Down
12 changes: 2 additions & 10 deletions datafusion/catalog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,17 @@
//! Implementations
//! * Information schema: [`information_schema`]
//! * Simple memory based catalog: [`MemoryCatalogProviderList`], [`MemoryCatalogProvider`], [`MemorySchemaProvider`]
//! * Listing schema: [`listing_schema`]

pub mod memory;
#[deprecated(
since = "46.0.0",
note = "use datafusion_sql::resolve::resolve_table_references"
)]
pub use datafusion_sql::resolve::resolve_table_references;
#[deprecated(
since = "46.0.0",
note = "use datafusion_common::{ResolvedTableReference, TableReference}"
)]
pub use datafusion_sql::{ResolvedTableReference, TableReference};
pub use memory::{
MemoryCatalogProvider, MemoryCatalogProviderList, MemorySchemaProvider,
};
mod r#async;
mod catalog;
mod dynamic_file;
pub mod information_schema;
pub mod listing_schema;
mod schema;
mod session;
mod table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use std::collections::HashSet;
use std::path::Path;
use std::sync::{Arc, Mutex};

use crate::catalog::{SchemaProvider, TableProvider, TableProviderFactory};
use crate::execution::context::SessionState;
use crate::{SchemaProvider, TableProvider, TableProviderFactory};

use crate::Session;
use datafusion_common::{
Constraints, DFSchema, DataFusionError, HashMap, TableReference,
};
Expand Down Expand Up @@ -88,7 +88,7 @@ impl ListingSchemaProvider {
}

/// Reload table information from ObjectStore
pub async fn refresh(&self, state: &SessionState) -> datafusion_common::Result<()> {
pub async fn refresh(&self, state: &dyn Session) -> datafusion_common::Result<()> {
let entries: Vec<_> = self.store.list(Some(&self.path)).try_collect().await?;
let base = Path::new(self.path.as_ref());
let mut tables = HashSet::new();
Expand Down
24 changes: 0 additions & 24 deletions datafusion/core/src/catalog_common/mod.rs

This file was deleted.

2 changes: 1 addition & 1 deletion datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ use std::sync::{Arc, Weak};

use super::options::ReadOptions;
use crate::{
catalog::listing_schema::ListingSchemaProvider,
catalog::{
CatalogProvider, CatalogProviderList, TableProvider, TableProviderFactory,
},
catalog_common::listing_schema::ListingSchemaProvider,
dataframe::DataFrame,
datasource::listing::{
ListingOptions, ListingTable, ListingTableConfig, ListingTableUrl,
Expand Down
6 changes: 3 additions & 3 deletions datafusion/core/src/execution/session_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,16 @@ impl SessionState {

/// Resolve all table references in the SQL statement. Does not include CTE references.
///
/// See [`datafusion_catalog::resolve_table_references`] for more information.
/// See [`datafusion_sql::resolve::resolve_table_references`] for more information.
///
/// [`datafusion_catalog::resolve_table_references`]: datafusion_catalog::resolve_table_references
/// [`datafusion_sql::resolve::resolve_table_references`]: datafusion_sql::resolve::resolve_table_references
pub fn resolve_table_references(
&self,
statement: &Statement,
) -> datafusion_common::Result<Vec<TableReference>> {
let enable_ident_normalization =
self.config.options().sql_parser.enable_ident_normalization;
let (table_refs, _) = datafusion_catalog::resolve_table_references(
let (table_refs, _) = datafusion_sql::resolve::resolve_table_references(
statement,
enable_ident_normalization,
)?;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/execution/session_state_defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// specific language governing permissions and limitations
// under the License.

use crate::catalog::listing_schema::ListingSchemaProvider;
use crate::catalog::{CatalogProvider, TableProviderFactory};
use crate::catalog_common::listing_schema::ListingSchemaProvider;
use crate::datasource::file_format::arrow::ArrowFormatFactory;
#[cfg(feature = "avro")]
use crate::datasource::file_format::avro::AvroFormatFactory;
Expand Down
1 change: 0 additions & 1 deletion datafusion/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,6 @@ pub const DATAFUSION_VERSION: &str = env!("CARGO_PKG_VERSION");
extern crate core;
extern crate sqlparser;

pub mod catalog_common;
pub mod dataframe;
pub mod datasource;
pub mod error;
Expand Down
4 changes: 0 additions & 4 deletions datafusion/datasource-csv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ datafusion-physical-expr = { workspace = true }
datafusion-physical-expr-common = { workspace = true }
datafusion-physical-plan = { workspace = true }
futures = { workspace = true }
itertools = { workspace = true }
log = { workspace = true }
object_store = { workspace = true }
rand = { workspace = true }
regex = { workspace = true }
tokio = { workspace = true }
url = { workspace = true }

[lints]
workspace = true
Expand Down