You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/03 21:58:46 UTC

[GitHub] [arrow-datafusion] Dandandan commented on a change in pull request #487: Fixed inference of multiple json files.

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



##########
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:
       One edge case I think this doesn't take care of:
   
   * Integer division by `filenames.len()` is 0 when the number of files is bigger than the number of records.




-- 
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:
users@infra.apache.org