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): Correctly display multilevel nested Arrays #18687

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

eitsupi
Copy link
Contributor

@eitsupi eitsupi commented Sep 11, 2024

While trying to get a py-polars-like display on Rust in r-polars, I noticed a lack of functionality on the Rust side.
https://github.com/pola-rs/r-polars/blob/de575b0a72664b5f386fb6dfd72024122179e8e2/src/rust/src/datatypes.rs#L71-L95

The following example shows that the type is not displayed correctly when the Series is displayed in Python.

>>> import polars as pl
>>> pl.Array(pl.List(pl.Array(pl.Int8, (2, 2))), 2)
Array(List(Array(Int8, shape=(2, 2))), shape=(2,))
>>> pl.Series(dtype=pl.Array(pl.List(pl.Array(pl.Int8, (2, 2))), 2))
shape: (0,)
Series: '' [array[i8, 2]]
[
]

This PR should be modified as follows to eliminate the difference in display between Python and Rust.

>>> pl.Series(dtype=pl.Array(pl.List(pl.Array(pl.Int8, (2, 2))), 2))
shape: (0,)
Series: '' [array[list[array[i8, (2, 2)]], 2]]
[
]

Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.91%. Comparing base (79b91c3) to head (f700fab).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-core/src/datatypes/dtype.rs 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18687      +/-   ##
==========================================
- Coverage   79.92%   79.91%   -0.02%     
==========================================
  Files        1513     1513              
  Lines      203334   203343       +9     
  Branches     2892     2892              
==========================================
- Hits       162510   162495      -15     
- Misses      40276    40300      +24     
  Partials      548      548              

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

@ritchie46 ritchie46 merged commit ca383a0 into pola-rs:main Sep 12, 2024
26 checks passed
@eitsupi eitsupi deleted the fix-array-display branch September 12, 2024 10:13
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.

2 participants