alamb commented on issue #8723:
URL: 
https://github.com/apache/arrow-datafusion/issues/8723#issuecomment-1879294920

   I didn't have a chance to review 
https://github.com/marvinlanhenke/arrow-datafusion/blob/poc_optimize_get_req/datafusion/core/src/datasource/physical_plan/json.rs#L232-L381
 in fine detail, but in general I think that code is looking very hard to 
navagate / test as it is so deeply nested in futures / closures.
   
   My suggestion is to try and extract the logic somehow into a structure that 
is easier to test and reason about.
   
   For example, maybe you could create a struct like
   
   ```struct
   struct StreamingJsonReaderBuilder {
    ...
   }
   
   impl StreamingJsonReaderBuilder {
     fn new(..) {}
     fn with_range(mut self, range: ..) ...
     fn build () -> SendableRecordBatchStream
   }
   ```
   
   And the you could start writing tests like 
   
   ```
   let object_store = ...;
   let input = StreamingJsonReaderBuilder::new(object_store.read())
     .with_range(Range::new(100, 200))
     .build;
   
   let batches = collect(input)
   assert_batches_eq(..)
   ```
   
   That might not be the right structure, but I am trying to give you the 
flavor of what encapsulating the complexity might look like it


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to