@@ -263,15 +263,16 @@ impl TableProvider for DataFusionTable {
263263
264264// Create a fake object store URL. Different table paths should produce fake URLs
265265// that differ in the host name, because DF's DefaultObjectStoreRegistry only takes
266- // hostname into account
266+ // hostname into account for object store keys
267267fn fake_object_store_url ( table_location_url : & str ) -> Option < ObjectStoreUrl > {
268268 let mut u = url:: Url :: parse ( table_location_url) . ok ( ) ?;
269269 u. set_host ( Some ( & format ! (
270- "{}{}" ,
271- u. host_str( ) . unwrap_or( "- " ) ,
270+ "{}-0 {}" ,
271+ u. host_str( ) . unwrap_or( "" ) . replace ( '-' , "-1 ") ,
272272 u. path( )
273- . replace( object_store:: path:: DELIMITER , "-" )
274- . replace( ':' , "-" )
273+ . replace( '-' , "-1" )
274+ . replace( object_store:: path:: DELIMITER , "-2" )
275+ . replace( ':' , "-3" )
275276 ) ) )
276277 . unwrap ( ) ;
277278 u. set_path ( "" ) ;
@@ -1673,7 +1674,11 @@ mod tests {
16731674 fn test_fake_object_store_url ( ) {
16741675 assert_eq ! (
16751676 fake_object_store_url( "s3://aaa/bbb/ccc" ) ,
1676- Some ( ObjectStoreUrl :: parse( "s3://aaa-bbb-ccc" ) . unwrap( ) ) ,
1677+ Some ( ObjectStoreUrl :: parse( "s3://aaa-0-2bbb-2ccc" ) . unwrap( ) ) ,
1678+ ) ;
1679+ assert_eq ! (
1680+ fake_object_store_url( "s3://aaa/bbb-ccc" ) ,
1681+ Some ( ObjectStoreUrl :: parse( "s3://aaa-0-2bbb-1ccc" ) . unwrap( ) ) ,
16771682 ) ;
16781683 assert_eq ! ( fake_object_store_url( "invalid url" ) , None ) ;
16791684 }
0 commit comments