@@ -257,7 +257,11 @@ impl SqlCatalog {
257257 "StorageFactory must be provided for SqlCatalog. Use `with_storage_factory` to configure it." ,
258258 )
259259 } ) ?;
260- let fileio = FileIOBuilder :: new ( factory) . build ( ) ;
260+ // Forward catalog props so storage-backend keys reach the FileIO.
261+ // Unrecognized keys are ignored by backends.
262+ let fileio = FileIOBuilder :: new ( factory)
263+ . with_props ( config. props . clone ( ) )
264+ . build ( ) ;
261265
262266 install_default_drivers ( ) ;
263267 let max_connections: u32 = config
@@ -598,7 +602,7 @@ impl Catalog for SqlCatalog {
598602 let mut tx = self . connection . begin ( ) . await . map_err ( from_sqlx_error) ?;
599603 let update_stmt = format ! (
600604 "UPDATE {NAMESPACE_TABLE_NAME} SET {NAMESPACE_FIELD_PROPERTY_VALUE} = ?
601- WHERE {CATALOG_FIELD_CATALOG_NAME} = ?
605+ WHERE {CATALOG_FIELD_CATALOG_NAME} = ?
602606 AND {NAMESPACE_FIELD_NAME} = ?
603607 AND {NAMESPACE_FIELD_PROPERTY_KEY} = ?"
604608 ) ;
@@ -689,7 +693,7 @@ impl Catalog for SqlCatalog {
689693 WHERE {CATALOG_FIELD_TABLE_NAMESPACE} = ?
690694 AND {CATALOG_FIELD_CATALOG_NAME} = ?
691695 AND (
692- {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
696+ {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
693697 OR {CATALOG_FIELD_RECORD_TYPE} IS NULL
694698 )" ,
695699 ) ,
@@ -728,7 +732,7 @@ impl Catalog for SqlCatalog {
728732 AND {CATALOG_FIELD_CATALOG_NAME} = ?
729733 AND {CATALOG_FIELD_TABLE_NAME} = ?
730734 AND (
731- {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
735+ {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
732736 OR {CATALOG_FIELD_RECORD_TYPE} IS NULL
733737 )"
734738 ) ,
@@ -755,7 +759,7 @@ impl Catalog for SqlCatalog {
755759 AND {CATALOG_FIELD_TABLE_NAME} = ?
756760 AND {CATALOG_FIELD_TABLE_NAMESPACE} = ?
757761 AND (
758- {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
762+ {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
759763 OR {CATALOG_FIELD_RECORD_TYPE} IS NULL
760764 )"
761765 ) ,
@@ -791,7 +795,7 @@ impl Catalog for SqlCatalog {
791795 AND {CATALOG_FIELD_TABLE_NAME} = ?
792796 AND {CATALOG_FIELD_TABLE_NAMESPACE} = ?
793797 AND (
794- {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
798+ {CATALOG_FIELD_RECORD_TYPE} = '{CATALOG_FIELD_TABLE_RECORD_TYPE}'
795799 OR {CATALOG_FIELD_RECORD_TYPE} IS NULL
796800 )"
797801 ) ,
@@ -1180,6 +1184,33 @@ mod tests {
11801184 new_sql_catalog ( warehouse_loc. clone ( ) , Some ( "iceberg" ) ) . await ;
11811185 }
11821186
1187+ // Regression test: storage-backend props set on the catalog must reach
1188+ // the FileIO; otherwise authenticated backends fail with 401s on writes.
1189+ #[ tokio:: test]
1190+ async fn test_storage_props_propagate_to_file_io ( ) {
1191+ let sql_lite_uri = format ! ( "sqlite:{}" , temp_path( ) ) ;
1192+ sqlx:: Sqlite :: create_database ( & sql_lite_uri) . await . unwrap ( ) ;
1193+ let warehouse_location = temp_path ( ) ;
1194+
1195+ let catalog = SqlCatalogBuilder :: default ( )
1196+ . with_storage_factory ( Arc :: new ( LocalFsStorageFactory ) )
1197+ . load (
1198+ "iceberg" ,
1199+ HashMap :: from_iter ( [
1200+ ( SQL_CATALOG_PROP_URI . to_string ( ) , sql_lite_uri) ,
1201+ ( SQL_CATALOG_PROP_WAREHOUSE . to_string ( ) , warehouse_location) ,
1202+ ( "s3.region" . to_string ( ) , "us-east-1" . to_string ( ) ) ,
1203+ ( "hf.token" . to_string ( ) , "hf_test_token" . to_string ( ) ) ,
1204+ ] ) ,
1205+ )
1206+ . await
1207+ . unwrap ( ) ;
1208+
1209+ let props = catalog. fileio . config ( ) . props ( ) ;
1210+ assert_eq ! ( props. get( "s3.region" ) , Some ( & "us-east-1" . to_string( ) ) ) ;
1211+ assert_eq ! ( props. get( "hf.token" ) , Some ( & "hf_test_token" . to_string( ) ) ) ;
1212+ }
1213+
11831214 #[ tokio:: test]
11841215 async fn test_builder_method ( ) {
11851216 let sql_lite_uri = format ! ( "sqlite:{}" , temp_path( ) ) ;
0 commit comments