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!: Remove supertype definition of List and non-List types #16918

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jun 13, 2024

Closes #10920

Various operations would add nesting levels on behalf of the user. We will now raise an error instead. The user should manually cast their data to a List if they want to combine their non-List data with List data.

Example

Before:

>>> s1 = pl.Series(["a", "b"])
>>> s2 = pl.Series([["x", "y"], ["z"]])
>>> pl.concat([s1, s2])
shape: (4,)
Series: '' [list[str]]
[
        ["a"]
        ["b"]
        ["x", "y"]
        ["z"]
]

After:

>>> pl.concat([s1, s2])
Traceback (most recent call last):
...
polars.exceptions.SchemaError: type List(String) is incompatible with expected type String

Use instead:

>>> s1_list = s1.cast(pl.List(s1.dtype))
>>> pl.concat([s1_list, s2])
shape: (4,)
Series: '' [list[str]]
[
        ["a"]
        ["b"]
        ["x", "y"]
        ["z"]
]

@github-actions github-actions bot added breaking Change that breaks backwards compatibility fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Jun 13, 2024
@stinodego stinodego changed the title fix!: Remove List supertype definition fix!: Remove supertype definition of List and non-List types Jun 13, 2024
@ritchie46 ritchie46 marked this pull request as ready for review June 13, 2024 12:13
Copy link

codecov bot commented Jun 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.09%. Comparing base (f7cca90) to head (8439a9e).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16918      +/-   ##
==========================================
- Coverage   81.43%   81.09%   -0.35%     
==========================================
  Files        1425     1435      +10     
  Lines      187973   189553    +1580     
  Branches     2704     2712       +8     
==========================================
+ Hits       153074   153710     +636     
- Misses      34402    35343     +941     
- Partials      497      500       +3     

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

Copy link

codspeed-hq bot commented Jun 13, 2024

CodSpeed Performance Report

Merging #16918 will degrade performances by 15.93%

Comparing list-supertype (8439a9e) with main (9914d96)

Summary

❌ 1 regressions
✅ 36 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main list-supertype Change
test_groupby_h2oai_q1 2.3 ms 2.8 ms -15.93%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation breaking Change that breaks backwards compatibility fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

column of type int compared to list[int] of length 1 evaluating as true
3 participants