55use async_trait:: async_trait;
66use chrono:: DateTime ;
77use datafusion_expr:: { dml:: InsertOp , utils:: conjunction, JoinType } ;
8+ use derive_builder:: Builder ;
89use futures:: { stream, StreamExt , TryStreamExt } ;
910use itertools:: Itertools ;
1011use 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
7880impl 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+
102111impl 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