Skip to content

Commit

Permalink
module renames
Browse files Browse the repository at this point in the history
catalog -> catalog_common
catalog_api -> catalog
  • Loading branch information
findepi committed Jul 22, 2024
1 parent 9d718f4 commit 0d6252f
Show file tree
Hide file tree
Showing 25 changed files with 44 additions and 41 deletions.
4 changes: 2 additions & 2 deletions datafusion-cli/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::sync::{Arc, Weak};

use crate::object_storage::{get_object_store, AwsOptions, GcpOptions};

use datafusion::catalog_api::{CatalogProvider, CatalogProviderList, SchemaProvider};
use datafusion::catalog::{CatalogProvider, CatalogProviderList, SchemaProvider};
use datafusion::common::plan_datafusion_err;
use datafusion::datasource::listing::{
ListingTable, ListingTableConfig, ListingTableUrl,
Expand Down Expand Up @@ -236,7 +236,7 @@ fn substitute_tilde(cur: String) -> String {
mod tests {
use super::*;

use datafusion::catalog_api::SchemaProvider;
use datafusion::catalog::SchemaProvider;
use datafusion::prelude::SessionContext;

fn setup_context() -> (SessionContext, Arc<dyn SchemaProvider>) {
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use arrow::record_batch::RecordBatch;
use arrow::util::pretty::pretty_format_batches;
use async_trait::async_trait;

use datafusion::catalog_api::CatalogSession;
use datafusion::catalog::CatalogSession;
use datafusion::common::{plan_err, Column};
use datafusion::datasource::function::TableFunctionImpl;
use datafusion::datasource::TableProvider;
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/advanced_parquet_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use arrow::array::{ArrayRef, Int32Array, RecordBatch, StringArray};
use arrow_schema::SchemaRef;
use async_trait::async_trait;
use bytes::Bytes;
use datafusion::catalog_api::CatalogSession;
use datafusion::catalog::CatalogSession;
use datafusion::datasource::listing::PartitionedFile;
use datafusion::datasource::physical_plan::parquet::{
ParquetAccessPlan, ParquetExecBuilder,
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use async_trait::async_trait;
use datafusion::{
arrow::util::pretty,
catalog_api::{CatalogProvider, CatalogProviderList, SchemaProvider},
catalog::{CatalogProvider, CatalogProviderList, SchemaProvider},
datasource::{
file_format::{csv::CsvFormat, FileFormat},
listing::{ListingOptions, ListingTable, ListingTableConfig, ListingTableUrl},
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/custom_datasource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use datafusion_expr::LogicalPlanBuilder;
use datafusion_physical_expr::EquivalenceProperties;

use async_trait::async_trait;
use datafusion::catalog_api::CatalogSession;
use datafusion::catalog::CatalogSession;
use tokio::time::timeout;

/// This example demonstrates executing a simple query against a custom datasource
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/parquet_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use arrow::datatypes::Int32Type;
use arrow::util::pretty::pretty_format_batches;
use arrow_schema::SchemaRef;
use async_trait::async_trait;
use datafusion::catalog_api::CatalogSession;
use datafusion::catalog::CatalogSession;
use datafusion::datasource::listing::PartitionedFile;
use datafusion::datasource::physical_plan::{
parquet::StatisticsConverter,
Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/examples/simple_udtf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use arrow::csv::ReaderBuilder;
use async_trait::async_trait;
use datafusion::arrow::datatypes::SchemaRef;
use datafusion::arrow::record_batch::RecordBatch;
use datafusion::catalog_api::CatalogSession;
use datafusion::catalog::CatalogSession;
use datafusion::datasource::function::TableFunctionImpl;
use datafusion::datasource::TableProvider;
use datafusion::error::Result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use arrow::{
record_batch::RecordBatch,
};

use crate::catalog_api::{CatalogProviderList, SchemaProvider, TableProvider};
use crate::catalog::{CatalogProviderList, SchemaProvider, TableProvider};
use crate::datasource::streaming::StreamingTable;
use crate::execution::context::TaskContext;
use crate::logical_expr::TableType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::collections::{HashMap, HashSet};
use std::path::Path;
use std::sync::{Arc, Mutex};

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

use datafusion_common::{Constraints, DFSchema, DataFusionError, TableReference};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
//! [`MemoryCatalogProvider`], [`MemoryCatalogProviderList`]: In-memory
//! implementations of [`CatalogProviderList`] and [`CatalogProvider`].
use crate::catalog_api::{
use crate::catalog::{
CatalogProvider, CatalogProviderList, SchemaProvider, TableProvider,
};
use async_trait::async_trait;
Expand Down Expand Up @@ -201,8 +201,8 @@ impl SchemaProvider for MemorySchemaProvider {
#[cfg(test)]
mod test {
use super::*;
use crate::catalog::memory::MemorySchemaProvider;
use crate::catalog::CatalogProvider;
use crate::catalog_common::memory::MemorySchemaProvider;
use crate::datasource::empty::EmptyTable;
use crate::datasource::listing::{ListingTable, ListingTableConfig, ListingTableUrl};
use crate::prelude::SessionContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub mod information_schema;
pub mod listing_schema;
pub mod memory;

pub use crate::catalog_api::{CatalogProvider, CatalogProviderList, SchemaProvider};
pub use crate::catalog::{CatalogProvider, CatalogProviderList, SchemaProvider};
pub use memory::{
MemoryCatalogProvider, MemoryCatalogProviderList, MemorySchemaProvider,
};
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/file_format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub trait FileFormatFactory: Sync + Send + GetExt {
/// from the [`TableProvider`]. This helps code re-utilization across
/// providers that support the same file formats.
///
/// [`TableProvider`]: crate::catalog_api::TableProvider
/// [`TableProvider`]: crate::catalog::TableProvider
#[async_trait]
pub trait FileFormat: Send + Sync + fmt::Debug {
/// Returns the table provider as [`Any`](std::any::Any) so that it can be
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/listing/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::{any::Any, sync::Arc};
use super::helpers::{expr_applicable_for_cols, pruned_partition_list, split_files};
use super::PartitionedFile;

use crate::catalog_api::TableProvider;
use crate::catalog::TableProvider;
use crate::datasource::{create_ordering, get_statistics_with_limit, TableType};
use crate::datasource::{
file_format::{file_compression_type::FileCompressionType, FileFormat},
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/listing_table_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use std::path::Path;
use std::sync::Arc;

use crate::catalog_api::{TableProvider, TableProviderFactory};
use crate::catalog::{TableProvider, TableProviderFactory};
use crate::datasource::listing::{
ListingOptions, ListingTable, ListingTableConfig, ListingTableUrl,
};
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub use self::default_table_source::{
};
pub use self::memory::MemTable;
pub use self::view::ViewTable;
pub use crate::catalog_api::TableProvider;
pub use crate::catalog::TableProvider;
pub use crate::logical_expr::TableType;
pub use statistics::get_statistics_with_limit;

Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use datafusion_catalog::CatalogSession;
use datafusion_expr::CreateExternalTable;
pub use datafusion_expr::{TableProviderFilterPushDown, TableType};

use crate::catalog_api::{TableProvider, TableProviderFactory};
use crate::catalog::{TableProvider, TableProviderFactory};
use crate::datasource::listing_table_factory::ListingTableFactory;
use crate::datasource::stream::StreamTableFactory;
use crate::error::Result;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/datasource/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;

use crate::catalog_api::{TableProvider, TableProviderFactory};
use crate::catalog::{TableProvider, TableProviderFactory};
use crate::datasource::create_ordering;

use arrow_array::{RecordBatch, RecordBatchReader, RecordBatchWriter};
Expand Down
12 changes: 7 additions & 5 deletions datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ use std::sync::{Arc, Weak};

use super::options::ReadOptions;
use crate::{
catalog::listing_schema::ListingSchemaProvider,
catalog::memory::MemorySchemaProvider,
catalog::{CatalogProvider, CatalogProviderList, MemoryCatalogProvider},
catalog_api::{TableProvider, TableProviderFactory},
catalog::{
CatalogProvider, CatalogProviderList, TableProvider, TableProviderFactory,
},
catalog_common::listing_schema::ListingSchemaProvider,
catalog_common::memory::MemorySchemaProvider,
catalog_common::MemoryCatalogProvider,
dataframe::DataFrame,
datasource::{
function::{TableFunction, TableFunctionImpl},
Expand Down Expand Up @@ -1578,7 +1580,7 @@ mod tests {

use datafusion_common_runtime::SpawnedTask;

use crate::catalog_api::SchemaProvider;
use crate::catalog::SchemaProvider;
use crate::execution::session_state::SessionStateBuilder;
use crate::physical_planner::PhysicalPlanner;
use async_trait::async_trait;
Expand Down
13 changes: 7 additions & 6 deletions datafusion/core/src/execution/session_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

//! [`SessionState`]: information required to run queries in a session
use crate::catalog::information_schema::{InformationSchemaProvider, INFORMATION_SCHEMA};
use crate::catalog::{CatalogProviderList, MemoryCatalogProviderList};
use crate::catalog_api::SchemaProvider;
use crate::catalog_api::TableProviderFactory;
use crate::catalog::{CatalogProviderList, SchemaProvider, TableProviderFactory};
use crate::catalog_common::information_schema::{
InformationSchemaProvider, INFORMATION_SCHEMA,
};
use crate::catalog_common::MemoryCatalogProviderList;
use crate::datasource::cte_worktable::CteWorkTable;
use crate::datasource::file_format::{format_as_file_type, FileFormatFactory};
use crate::datasource::function::{TableFunction, TableFunctionImpl};
Expand Down Expand Up @@ -146,7 +147,7 @@ pub struct SessionState {
/// `CREATE EXTERNAL TABLE ... STORED AS <FORMAT>` for custom file
/// formats other than those built into DataFusion
///
/// [`TableProvider`]: crate::catalog_api::TableProvider
/// [`TableProvider`]: crate::catalog::TableProvider
table_factories: HashMap<String, Arc<dyn TableProviderFactory>>,
/// Runtime environment
runtime_env: Arc<RuntimeEnv>,
Expand Down Expand Up @@ -524,7 +525,7 @@ impl SessionState {
) -> datafusion_common::Result<Vec<TableReference>> {
let enable_ident_normalization =
self.config.options().sql_parser.enable_ident_normalization;
let (table_refs, _) = crate::catalog::resolve_table_references(
let (table_refs, _) = crate::catalog_common::resolve_table_references(
statement,
enable_ident_normalization,
)?;
Expand Down
6 changes: 3 additions & 3 deletions datafusion/core/src/execution/session_state_defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.

use crate::catalog::listing_schema::ListingSchemaProvider;
use crate::catalog::{MemoryCatalogProvider, MemorySchemaProvider};
use crate::catalog_api::{CatalogProvider, TableProviderFactory};
use crate::catalog::{CatalogProvider, TableProviderFactory};
use crate::catalog_common::listing_schema::ListingSchemaProvider;
use crate::catalog_common::{MemoryCatalogProvider, MemorySchemaProvider};
use crate::datasource::file_format::arrow::ArrowFormatFactory;
use crate::datasource::file_format::avro::AvroFormatFactory;
use crate::datasource::file_format::csv::CsvFormatFactory;
Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ pub const DATAFUSION_VERSION: &str = env!("CARGO_PKG_VERSION");
extern crate core;
extern crate sqlparser;

pub mod catalog;
pub mod catalog_common;
pub mod dataframe;
pub mod datasource;
pub mod error;
Expand Down Expand Up @@ -536,7 +536,7 @@ pub use common::config;
// NB datafusion execution is re-exported in the `execution` module

/// re-export of [`datafusion_catalog`] crate
pub mod catalog_api {
pub mod catalog {
pub use datafusion_catalog::*;
}

Expand Down
2 changes: 1 addition & 1 deletion datafusion/core/src/test_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};

use crate::catalog_api::{TableProvider, TableProviderFactory};
use crate::catalog::{TableProvider, TableProviderFactory};
use crate::dataframe::DataFrame;
use crate::datasource::stream::{FileStreamProvider, StreamConfig, StreamTable};
use crate::datasource::{empty::EmptyTable, provider_as_source};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use std::sync::Arc;
use arrow::array::{Int32Builder, Int64Array};
use arrow::datatypes::{DataType, Field, Schema, SchemaRef};
use arrow::record_batch::RecordBatch;
use datafusion::catalog_api::TableProvider;
use datafusion::catalog::TableProvider;
use datafusion::datasource::provider::TableType;
use datafusion::error::Result;
use datafusion::execution::context::TaskContext;
Expand Down
2 changes: 1 addition & 1 deletion datafusion/proto/tests/cases/roundtrip_logical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use arrow::datatypes::{
};
use prost::Message;

use datafusion::catalog_api::{TableProvider, TableProviderFactory};
use datafusion::catalog::{TableProvider, TableProviderFactory};
use datafusion::datasource::file_format::arrow::ArrowFormatFactory;
use datafusion::datasource::file_format::csv::CsvFormatFactory;
use datafusion::datasource::file_format::format_as_file_type;
Expand Down
6 changes: 3 additions & 3 deletions datafusion/sqllogictest/src/test_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ use datafusion::logical_expr::{create_udf, ColumnarValue, Expr, ScalarUDF, Volat
use datafusion::physical_plan::ExecutionPlan;
use datafusion::prelude::SessionConfig;
use datafusion::{
catalog::{memory::MemoryCatalogProvider, memory::MemorySchemaProvider},
catalog_api::CatalogProvider,
catalog::CatalogProvider,
catalog_common::{memory::MemoryCatalogProvider, memory::MemorySchemaProvider},
datasource::{MemTable, TableProvider, TableType},
prelude::{CsvReadOptions, SessionContext},
};
use datafusion_common::cast::as_float64_array;
use datafusion_common::DataFusionError;

use async_trait::async_trait;
use datafusion::catalog_api::CatalogSession;
use datafusion::catalog::CatalogSession;
use log::info;
use tempfile::TempDir;

Expand Down

0 comments on commit 0d6252f

Please sign in to comment.