@@ -28,7 +28,8 @@ fn get_schema() -> StructType {
28
28
] )
29
29
}
30
30
31
- fn table_config ( ) -> TableConfiguration {
31
+ fn table_config ( path : & Path ) -> TableConfiguration {
32
+ let table_root = url:: Url :: from_directory_path ( path) . unwrap ( ) ;
32
33
let schema_string = serde_json:: to_string ( & get_schema ( ) ) . unwrap ( ) ;
33
34
let metadata = Metadata {
34
35
schema_string,
@@ -49,7 +50,7 @@ fn table_config() -> TableConfiguration {
49
50
Some ( [ WriterFeatures :: ColumnMapping ] ) ,
50
51
)
51
52
. unwrap ( ) ;
52
- TableConfiguration :: try_new ( metadata, protocol) . unwrap ( )
53
+ TableConfiguration :: try_new ( metadata, protocol, table_root , 0 ) . unwrap ( )
53
54
}
54
55
55
56
fn get_segment (
@@ -111,8 +112,9 @@ async fn metadata_protocol() {
111
112
. unwrap ( )
112
113
. into_iter ( ) ;
113
114
115
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
114
116
let scan_batches =
115
- table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
117
+ table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
116
118
. unwrap ( ) ;
117
119
let sv = result_to_sv ( scan_batches) ;
118
120
assert_eq ! ( sv, & [ false , false ] ) ;
@@ -137,8 +139,9 @@ async fn cdf_not_enabled() {
137
139
. unwrap ( )
138
140
. into_iter ( ) ;
139
141
142
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
140
143
let res: DeltaResult < Vec < _ > > =
141
- table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
144
+ table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
142
145
. unwrap ( )
143
146
. try_collect ( ) ;
144
147
@@ -168,8 +171,9 @@ async fn unsupported_reader_feature() {
168
171
. unwrap ( )
169
172
. into_iter ( ) ;
170
173
174
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
171
175
let res: DeltaResult < Vec < _ > > =
172
- table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
176
+ table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
173
177
. unwrap ( )
174
178
. try_collect ( ) ;
175
179
@@ -199,8 +203,9 @@ async fn column_mapping_should_fail() {
199
203
. unwrap ( )
200
204
. into_iter ( ) ;
201
205
206
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
202
207
let res: DeltaResult < Vec < _ > > =
203
- table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
208
+ table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
204
209
. unwrap ( )
205
210
. try_collect ( ) ;
206
211
@@ -230,8 +235,9 @@ async fn incompatible_schemas_fail() {
230
235
. unwrap ( )
231
236
. into_iter ( ) ;
232
237
238
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
233
239
let res: DeltaResult < Vec < _ > > =
234
- table_changes_action_iter ( engine, commits, cdf_schema. into ( ) , None , table_config ( ) )
240
+ table_changes_action_iter ( engine, commits, cdf_schema. into ( ) , None , table_config)
235
241
. unwrap ( )
236
242
. try_collect ( ) ;
237
243
@@ -320,7 +326,8 @@ async fn add_remove() {
320
326
. unwrap ( )
321
327
. into_iter ( ) ;
322
328
323
- let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
329
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
330
+ let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
324
331
. unwrap ( )
325
332
. flat_map ( |scan_data| {
326
333
let scan_data = scan_data. unwrap ( ) ;
@@ -370,7 +377,8 @@ async fn filter_data_change() {
370
377
. unwrap ( )
371
378
. into_iter ( ) ;
372
379
373
- let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
380
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
381
+ let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
374
382
. unwrap ( )
375
383
. flat_map ( |scan_data| {
376
384
let scan_data = scan_data. unwrap ( ) ;
@@ -416,7 +424,8 @@ async fn cdc_selection() {
416
424
. unwrap ( )
417
425
. into_iter ( ) ;
418
426
419
- let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
427
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
428
+ let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
420
429
. unwrap ( )
421
430
. flat_map ( |scan_data| {
422
431
let scan_data = scan_data. unwrap ( ) ;
@@ -482,7 +491,9 @@ async fn dv() {
482
491
} ,
483
492
) ] )
484
493
. into ( ) ;
485
- let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
494
+
495
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
496
+ let sv = table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
486
497
. unwrap ( )
487
498
. flat_map ( |scan_data| {
488
499
let scan_data = scan_data. unwrap ( ) ;
@@ -559,12 +570,13 @@ async fn data_skipping_filter() {
559
570
. unwrap ( )
560
571
. into_iter ( ) ;
561
572
573
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
562
574
let sv = table_changes_action_iter (
563
575
engine,
564
576
commits,
565
577
logical_schema. into ( ) ,
566
578
predicate,
567
- table_config ( ) ,
579
+ table_config,
568
580
)
569
581
. unwrap ( )
570
582
. flat_map ( |scan_data| {
@@ -610,8 +622,9 @@ async fn failing_protocol() {
610
622
. unwrap ( )
611
623
. into_iter ( ) ;
612
624
625
+ let table_config = table_config ( mock_table. table_root ( ) ) ;
613
626
let res: DeltaResult < Vec < _ > > =
614
- table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config ( ) )
627
+ table_changes_action_iter ( engine, commits, get_schema ( ) . into ( ) , None , table_config)
615
628
. unwrap ( )
616
629
. try_collect ( ) ;
617
630
@@ -637,11 +650,12 @@ async fn file_meta_timestamp() {
637
650
638
651
let commit = commits. next ( ) . unwrap ( ) ;
639
652
let file_meta_ts = commit. location . last_modified ;
653
+ let mut table_config = table_config ( mock_table. table_root ( ) ) ;
640
654
let processed_commit = process_cdf_commit (
641
655
engine. as_ref ( ) ,
642
656
commit,
643
657
& get_schema ( ) . into ( ) ,
644
- & mut table_config ( ) ,
658
+ & mut table_config,
645
659
)
646
660
. unwrap ( ) ;
647
661
assert_eq ! ( processed_commit. timestamp, file_meta_ts) ;
0 commit comments