@@ -42,6 +42,7 @@ use url::Url;
4242
4343use crate :: catalog:: { NamespaceIdent , TableIdent } ;
4444use crate :: io:: refreshable_storage:: RefreshableOpenDalStorageBuilder ;
45+ use crate :: io:: storage:: config:: { PROP_METADATA_LOCATION , PROP_TABLE_IDENT } ;
4546use crate :: io:: {
4647 FileMetadata , FileRead , FileWrite , InputFile , OutputFile , Storage , StorageConfig ,
4748 StorageCredentialsLoader , StorageFactory ,
@@ -544,8 +545,11 @@ mod tests {
544545 let factory = RefreshableStorageFactory :: new ( loader) ;
545546 let table_ident = TableIdent :: from_strs ( [ "ns" , "tbl" ] ) . unwrap ( ) ;
546547 let config = StorageConfig :: new ( )
547- . with_location ( "s3://test-bucket/" )
548- . with_table_ident ( table_ident) ;
548+ . with_prop ( PROP_METADATA_LOCATION , "s3://test-bucket/" )
549+ . with_prop (
550+ PROP_TABLE_IDENT ,
551+ serde_json:: to_string ( & table_ident) . unwrap ( ) ,
552+ ) ;
549553 assert ! (
550554 factory. build( & config) . is_ok( ) ,
551555 "RefreshableStorageFactory should build a Refreshable storage successfully"
@@ -560,8 +564,11 @@ mod tests {
560564 let table_ident = TableIdent :: from_strs ( [ "ns" , "tbl" ] ) . unwrap ( ) ;
561565 // Initial credentials are merged into props before build() is called
562566 let config = StorageConfig :: new ( )
563- . with_location ( "s3://test-bucket/" )
564- . with_table_ident ( table_ident) ;
567+ . with_prop ( PROP_METADATA_LOCATION , "s3://test-bucket/" )
568+ . with_prop (
569+ PROP_TABLE_IDENT ,
570+ serde_json:: to_string ( & table_ident) . unwrap ( ) ,
571+ ) ;
565572 assert ! (
566573 factory. build( & config) . is_ok( ) ,
567574 "RefreshableStorageFactory should build successfully"
@@ -614,20 +621,26 @@ impl StorageFactory for RefreshableStorageFactory {
614621 )
615622 } ) ?;
616623
617- let location = config. location ( ) . unwrap_or ( "" ) . to_string ( ) ;
624+ // Extract runtime context from props, stripping the internal keys so they
625+ // don't leak into the underlying OpenDAL operator configuration.
626+ let mut props = config. props ( ) . clone ( ) ;
627+ let location = props. remove ( PROP_METADATA_LOCATION ) . unwrap_or_default ( ) ;
618628 let scheme = Url :: parse ( & location)
619629 . map ( |u| u. scheme ( ) . to_string ( ) )
620630 . unwrap_or_default ( ) ;
621- let table_ident = config. table_ident ( ) . cloned ( ) . unwrap_or_else ( || {
622- TableIdent :: new (
623- NamespaceIdent :: new ( "unknown" . to_string ( ) ) ,
624- "unknown" . to_string ( ) ,
625- )
626- } ) ;
631+ let table_ident = props
632+ . remove ( PROP_TABLE_IDENT )
633+ . and_then ( |s| serde_json:: from_str :: < TableIdent > ( & s) . ok ( ) )
634+ . unwrap_or_else ( || {
635+ TableIdent :: new (
636+ NamespaceIdent :: new ( "unknown" . to_string ( ) ) ,
637+ "unknown" . to_string ( ) ,
638+ )
639+ } ) ;
627640
628641 let backend = RefreshableOpenDalStorageBuilder :: new ( )
629642 . scheme ( scheme)
630- . base_props ( config . props ( ) . clone ( ) )
643+ . base_props ( props)
631644 . credentials_loader ( Arc :: clone ( loader) )
632645 . location ( location)
633646 . table_ident ( table_ident)
0 commit comments