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: Mark Expr.(lower|upper)_bound as returning scalar #18383

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

orlp
Copy link
Collaborator

@orlp orlp commented Aug 26, 2024

Necessary for the new streaming engine, but also fixes this (obscure) bug in the current engine:

>>> df = pl.DataFrame({"a": [1, 2, 3, 2, 1]})
>>> df.group_by("a").agg(pl.col("a").lower_bound().alias("lower"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/orlp/.localpython/lib/python3.11/site-packages/polars/dataframe/group_by.py", line 231, in agg
    .collect(no_optimization=True)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/orlp/.localpython/lib/python3.11/site-packages/polars/lazyframe/frame.py", line 2027, in collect
    return wrap_df(ldf.collect(callback))
                   ^^^^^^^^^^^^^^^^^^^^^
polars.exceptions.InvalidOperationError: output length of `map` (1) must be equal to the input length (5); consider using `apply` instead

Error originated in expression: 'col("a").lower_bound()'

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Aug 26, 2024
Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.82%. Comparing base (f07eea3) to head (fef2c78).
Report is 67 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18383   +/-   ##
=======================================
  Coverage   79.81%   79.82%           
=======================================
  Files        1496     1496           
  Lines      200338   200346    +8     
  Branches     2841     2841           
=======================================
+ Hits       159902   159921   +19     
+ Misses      39911    39900   -11     
  Partials      525      525           

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

@ritchie46 ritchie46 merged commit 6f5851d into pola-rs:main Aug 26, 2024
22 checks passed
@c-peters c-peters added the accepted Ready for implementation label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation 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.

3 participants