File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,14 @@ pub fn arrow_test_data() -> String {
255255#[ cfg( feature = "parquet" ) ]
256256pub fn parquet_test_data ( ) -> String {
257257 match get_data_dir ( "PARQUET_TEST_DATA" , "../../parquet-testing/data" ) {
258- Ok ( pb) => pb. display ( ) . to_string ( ) ,
258+ Ok ( pb) => {
259+ let mut path = pb. display ( ) . to_string ( ) ;
260+ if cfg ! ( target_os = "windows" ) {
261+ // Replace backslashes (Windows paths; avoids some test issues).
262+ path = path. replace ( "\\ " , "/" ) ;
263+ }
264+ path
265+ }
259266 Err ( err) => panic ! ( "failed to get parquet data dir: {err}" ) ,
260267 }
261268}
Original file line number Diff line number Diff line change @@ -284,7 +284,17 @@ fn verify_file_encrypted(
284284 options
285285 . options
286286 . insert ( "test_key" . to_string ( ) , "test value" . to_string ( ) ) ;
287- let object_path = object_store:: path:: Path :: from ( file_path. to_str ( ) . unwrap ( ) ) ;
287+
288+ let file_path_str = if cfg ! ( target_os = "windows" ) {
289+ // Windows backslashes are eventually converted to slashes when writing the Parquet files,
290+ // through `ListingTableUrl::parse`, making `encryption_factory.encryption_keys` store them
291+ // it that format. So we also replace backslashes here to ensure they match.
292+ file_path. to_str ( ) . unwrap ( ) . replace ( "\\ " , "/" )
293+ } else {
294+ file_path. to_str ( ) . unwrap ( ) . to_owned ( )
295+ } ;
296+
297+ let object_path = object_store:: path:: Path :: from ( file_path_str) ;
288298 let decryption_properties = encryption_factory
289299 . get_file_decryption_properties ( & options, & object_path) ?
290300 . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -76,7 +76,13 @@ async fn run_query() {
7676 let ctx = SessionContext :: new ( ) ;
7777
7878 // Get the test data directory
79- let test_data = parquet_test_data ( ) ;
79+ let test_data = if cfg ! ( target_os = "windows" ) {
80+ // Prefix Windows paths with "/", since they start with <Drive>:/ but the URI should be
81+ // test:///C:/... (https://datatracker.ietf.org/doc/html/rfc8089#appendix-E.2)
82+ format ! ( "/{}" , parquet_test_data( ) )
83+ } else {
84+ parquet_test_data ( )
85+ } ;
8086
8187 // Define a Parquet file format with pruning enabled
8288 let file_format = ParquetFormat :: default ( ) . with_enable_pruning ( true ) ;
You can’t perform that action at this time.
0 commit comments