@@ -1129,6 +1129,50 @@ mod tests {
11291129 }
11301130 }
11311131
1132+ #[ tokio:: test( flavor = "multi_thread" ) ]
1133+ async fn test_read_json_files_parallel_empty_files ( ) {
1134+ let store = Arc :: new ( InMemory :: new ( ) ) ;
1135+ let handler = DefaultJsonHandler :: new (
1136+ store,
1137+ Arc :: new ( TokioMultiThreadExecutor :: new (
1138+ tokio:: runtime:: Handle :: current ( ) ,
1139+ ) ) ,
1140+ )
1141+ . with_parallel_chunks ( NonZero :: new ( 4 ) ) ;
1142+ let physical_schema = schema_ref ! { nullable "val" : INTEGER } ;
1143+ let result: Vec < _ > = handler
1144+ . read_json_files ( & [ ] , physical_schema, None )
1145+ . unwrap ( )
1146+ . try_collect ( )
1147+ . unwrap ( ) ;
1148+ assert ! ( result. is_empty( ) , "empty file list must yield no batches" ) ;
1149+ }
1150+
1151+ #[ tokio:: test( flavor = "multi_thread" ) ]
1152+ async fn test_read_json_files_parallel_missing_file_errors ( ) {
1153+ let store = Arc :: new ( InMemory :: new ( ) ) ;
1154+ let missing_path = Path :: from ( "test/missing" ) ;
1155+ let url = Url :: parse ( & format ! ( "memory:/{missing_path}" ) ) . unwrap ( ) ;
1156+ let files = vec ! [ FileMeta {
1157+ location: url,
1158+ last_modified: 0 ,
1159+ size: 100 ,
1160+ } ] ;
1161+ let handler = DefaultJsonHandler :: new (
1162+ store,
1163+ Arc :: new ( TokioMultiThreadExecutor :: new (
1164+ tokio:: runtime:: Handle :: current ( ) ,
1165+ ) ) ,
1166+ )
1167+ . with_parallel_chunks ( NonZero :: new ( 4 ) ) ;
1168+ let physical_schema = schema_ref ! { nullable "val" : INTEGER } ;
1169+ let result: DeltaResult < Vec < _ > > = handler
1170+ . read_json_files ( & files, physical_schema, None )
1171+ . unwrap ( )
1172+ . try_collect ( ) ;
1173+ assert ! ( result. is_err( ) , "missing file must produce an error" ) ;
1174+ }
1175+
11321176 // Helper function to create test data
11331177 fn create_test_data ( values : Vec < & str > ) -> DeltaResult < Box < dyn EngineData > > {
11341178 let schema = Arc :: new ( ArrowSchema :: new ( vec ! [ Field :: new(
0 commit comments