Skip to content
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
11 changes: 4 additions & 7 deletions crates/core/src/table/file_format_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ use std::sync::Arc;
use tracing::info;
use uuid::Uuid;

#[cfg(not(feature = "datafusion"))]
#[derive(Clone, Default, Debug, PartialEq)]
pub struct TableOptions {}

// Top level trait for file format options used by a DeltaTable
#[cfg(feature = "datafusion")]
pub trait FileFormatOptions: Send + Sync + std::fmt::Debug + 'static {
#[cfg(feature = "datafusion")]
fn table_options(&self) -> TableOptions;

fn writer_properties_factory(&self) -> Arc<dyn WriterPropertiesFactory>;

#[cfg(feature = "datafusion")]
fn update_session(&self, session: &dyn Session) -> DeltaResult<()> {
// Default implementation does nothing
Ok(())
Expand All @@ -41,11 +38,13 @@ pub trait FileFormatOptions: Send + Sync + std::fmt::Debug + 'static {
/// Convenience alias for file format options reference used across the codebase
pub type FileFormatRef = Arc<dyn FileFormatOptions>;

#[cfg(feature = "datafusion")]
#[derive(Clone, Debug, Default)]
pub struct SimpleFileFormatOptions {
table_options: TableOptions,
}

#[cfg(feature = "datafusion")]
impl SimpleFileFormatOptions {
pub fn new(table_options: TableOptions) -> Self {
Self { table_options }
Expand All @@ -63,14 +62,12 @@ impl FileFormatOptions for SimpleFileFormatOptions {
}
}

#[cfg(feature = "datafusion")]
pub fn build_writer_properties_factory_ffo(
file_format_options: Option<FileFormatRef>,
) -> Option<Arc<dyn WriterPropertiesFactory>> {
file_format_options.map(|ffo| ffo.writer_properties_factory())
}

#[cfg(feature = "datafusion")]
pub fn build_writer_properties_factory_or_default_ffo(
file_format_options: Option<FileFormatRef>,
) -> Arc<dyn WriterPropertiesFactory> {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ pub mod state;
mod columns;
pub mod file_format_options;

// Re-exposing for backwards compatibility
use crate::table::file_format_options::FileFormatRef;
// Re-exposing for backwards compatibility
pub use columns::*;

/// In memory representation of a Delta Table
Expand Down