You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
keys/aggregates are not partitionable: running default HASH AGGREGATION
Traceback (most recent call last):
File "C:\Users\bholder\code\notebooks\bug_test.py", line 32, in<module>
bad_df = df.select(
File "C:\Users\bholder\code\notebooks\.venv\lib\site-packages\polars\dataframe\frame.py", line 7727, inselectreturnself.lazy().select(*exprs, **named_exprs).collect(eager=True)
File "C:\Users\bholder\code\notebooks\.venv\lib\site-packages\polars\utils\deprecation.py", line 95, in wrapper
return function(*args, **kwargs)
File "C:\Users\bholder\code\notebooks\.venv\lib\site-packages\polars\lazyframe\frame.py", line 1711, in collect
returnwrap_df(ldf.collect())
exceptions.ComputeError: `sort_by` produced different length: 8 than the series that has to be sorted: 3
Error originated in expression: 'col("cost").filter([(col("type")) == (Utf8(A))]).sort_by(by=[col("number")], descending=[false])'
Issue description
The behavior of sort_by is inconsistent. I'm not entirely certain about the correct mental model for understanding "multi-column" operations. In particular, I'm a bit surprised that the aggregate "sort_by_first" column gives the correct result.
Expected behavior
I expected sort_by to behave similarly in an aggregation context and in a general selection context, and especially for it to not "discard" a preceding filter operation.
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Code
Output
Log output
Issue description
The behavior of
sort_by
is inconsistent. I'm not entirely certain about the correct mental model for understanding "multi-column" operations. In particular, I'm a bit surprised that the aggregate "sort_by_first" column gives the correct result.Expected behavior
I expected
sort_by
to behave similarly in an aggregation context and in a general selection context, and especially for it to not "discard" a precedingfilter
operation.Installed versions
The text was updated successfully, but these errors were encountered: