houqp commented on a change in pull request #487:
URL: https://github.com/apache/arrow-datafusion/pull/487#discussion_r646175372



##########
File path: datafusion/src/physical_plan/json.rs
##########
@@ -202,16 +202,11 @@ impl NdJsonExec {
         max_records: Option<usize>,
     ) -> Result<Schema> {
         let mut schemas = Vec::new();
-        let mut records_to_read = max_records.unwrap_or(usize::MAX);
-        while records_to_read > 0 && !filenames.is_empty() {
+        let lines_per_file = max_records.map(|x| x / filenames.len());

Review comment:
       Round up to 1 seems like the only choice if we want to spread out the 
read. If we don't check whether the limit has been reached, this would change 
the semantic of the argument in both ways, i.e. it might read **more** or 
**less** than specified value. So the prefix `max_` would not be accurate 
anymore. If we want to go that route, it would be good to rename the argument 
or implement this behavior in a new method.




-- 
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.

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


Reply via email to