Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rust): Return empty DF when input is empty json list #18663

Closed
wants to merge 29 commits into from

Conversation

deanm0000
Copy link
Collaborator

fixes #7355

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 77.14286% with 8 lines in your changes missing coverage. Please review.

Project coverage is 79.93%. Comparing base (5c4e7e9) to head (ba1240b).

Files with missing lines Patch % Lines
crates/polars-io/src/json/infer.rs 55.55% 4 Missing ⚠️
crates/polars-io/src/json/mod.rs 84.61% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18663      +/-   ##
==========================================
+ Coverage   79.90%   79.93%   +0.02%     
==========================================
  Files        1512     1512              
  Lines      203203   203225      +22     
  Branches     2891     2891              
==========================================
+ Hits       162379   162445      +66     
+ Misses      40274    40230      -44     
  Partials      550      550              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

values,
self.infer_schema_len
.unwrap_or(NonZeroUsize::new(usize::MAX).unwrap()),
)?
.to_arrow(CompatLevel::newest())
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: .map(|supertype| supertype.to_arrow(CompatLevel::newest()))

};
if inner_dtype_result.is_err() {
match &json_value {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing the whole dtype inference and control flow. Could we start this function with this check, and just early return DataFrame::empty?

ritchie46 and others added 19 commits September 13, 2024 14:58
Co-authored-by: coastalwhite <me@gburghoorn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

polars.read_json fails when reading empty list from json response