@@ -271,14 +271,23 @@ impl StaticTable {
271
271
}
272
272
/// Creates a static table directly from metadata file and `FileIO`
273
273
pub async fn from_metadata_file (
274
- metadata_file_path : & str ,
274
+ metadata_location : & str ,
275
275
table_ident : TableIdent ,
276
276
file_io : FileIO ,
277
277
) -> Result < Self > {
278
- let metadata_file = file_io. new_input ( metadata_file_path ) ?;
278
+ let metadata_file = file_io. new_input ( metadata_location ) ?;
279
279
let metadata_file_content = metadata_file. read ( ) . await ?;
280
- let table_metadata = serde_json:: from_slice :: < TableMetadata > ( & metadata_file_content) ?;
281
- Self :: from_metadata ( table_metadata, table_ident, file_io) . await
280
+ let metadata = serde_json:: from_slice :: < TableMetadata > ( & metadata_file_content) ?;
281
+
282
+ let table = Table :: builder ( )
283
+ . metadata ( metadata)
284
+ . metadata_location ( metadata_location)
285
+ . identifier ( table_ident)
286
+ . file_io ( file_io. clone ( ) )
287
+ . readonly ( true )
288
+ . build ( ) ;
289
+
290
+ Ok ( Self ( table?) )
282
291
}
283
292
284
293
/// Create a TableScanBuilder for the static table.
@@ -356,6 +365,10 @@ mod tests {
356
365
let table = static_table. into_table ( ) ;
357
366
assert ! ( table. readonly( ) ) ;
358
367
assert_eq ! ( table. identifier. name( ) , "static_table" ) ;
368
+ assert_eq ! (
369
+ table. metadata_location( ) ,
370
+ Some ( metadata_file_path) . as_deref( )
371
+ ) ;
359
372
}
360
373
361
374
#[ tokio:: test]
0 commit comments