File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
native/core/src/execution/operators Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -332,18 +332,27 @@ impl ParquetWriterExec {
332332 ) )
333333 }
334334 "local" => {
335- // For local file system, write directly to file
335+ // For a local file system, write directly to file
336336 // Strip file:// or file: prefix if present
337337 let local_path = output_file_path
338338 . strip_prefix ( "file://" )
339339 . or_else ( || output_file_path. strip_prefix ( "file:" ) )
340340 . unwrap_or ( output_file_path) ;
341341
342- // Create output directory
343- std:: fs:: create_dir_all ( local_path) . map_err ( |e| {
342+ // Extract the parent directory from the file path
343+ let output_dir = std:: path:: Path :: new ( local_path) . parent ( ) . ok_or_else ( || {
344+ DataFusionError :: Execution ( format ! (
345+ "Failed to extract parent directory from path '{}'" ,
346+ local_path
347+ ) )
348+ } ) ?;
349+
350+ // Create the parent directory if it doesn't exist
351+ std:: fs:: create_dir_all ( output_dir) . map_err ( |e| {
344352 DataFusionError :: Execution ( format ! (
345353 "Failed to create output directory '{}': {}" ,
346- local_path, e
354+ output_dir. display( ) ,
355+ e
347356 ) )
348357 } ) ?;
349358
You can’t perform that action at this time.
0 commit comments