Skip to content

Commit 60ff613

Browse files
author
Jan Kaul
committed
add DataFusionTableConfig
1 parent c2f3e4c commit 60ff613

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion_iceberg/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ chrono = { workspace = true }
1515
dashmap = "6.1.0"
1616
datafusion = { workspace = true }
1717
datafusion-expr = { workspace = true }
18+
derive_builder = { workspace = true }
1819
futures = { workspace = true }
1920
iceberg-rust = { path = "../iceberg-rust", version = "0.7.0" }
2021
itertools = { workspace = true }

datafusion_iceberg/src/table.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use async_trait::async_trait;
66
use chrono::DateTime;
77
use datafusion_expr::{dml::InsertOp, utils::conjunction, JoinType};
8+
use derive_builder::Builder;
89
use futures::{stream, StreamExt, TryStreamExt};
910
use itertools::Itertools;
1011
use object_store::ObjectMeta;
@@ -73,6 +74,7 @@ pub struct DataFusionTable {
7374
pub schema: SchemaRef,
7475
pub snapshot_range: (Option<i64>, Option<i64>),
7576
pub branch: Option<String>,
77+
pub config: Option<DataFusionTableConfig>,
7678
}
7779

7880
impl From<Tabular> for DataFusionTable {
@@ -99,12 +101,28 @@ impl From<MaterializedView> for DataFusionTable {
99101
}
100102
}
101103

104+
#[derive(Clone, Debug, Builder)]
105+
pub struct DataFusionTableConfig {
106+
/// With this option, an additional "__data_file_path" column is added to the output of the
107+
/// TableProvider that contains the path of the data-file the row originates from.
108+
enable_data_file_path_column: bool,
109+
}
110+
102111
impl DataFusionTable {
103112
pub fn new(
104113
tabular: Tabular,
105114
start: Option<i64>,
106115
end: Option<i64>,
107116
branch: Option<&str>,
117+
) -> Self {
118+
Self::new_with_config(tabular, start, end, branch, None)
119+
}
120+
pub fn new_with_config(
121+
tabular: Tabular,
122+
start: Option<i64>,
123+
end: Option<i64>,
124+
branch: Option<&str>,
125+
config: Option<DataFusionTableConfig>,
108126
) -> Self {
109127
let schema = match &tabular {
110128
Tabular::Table(table) => {
@@ -131,6 +149,7 @@ impl DataFusionTable {
131149
snapshot_range: (start, end),
132150
schema,
133151
branch: branch.map(ToOwned::to_owned),
152+
config,
134153
}
135154
}
136155
#[inline]

0 commit comments

Comments
 (0)