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

feat: argument 'asc' or 'desc' missing in method sort() in ibis/expr/types/arrays.py #10442

Open
1 task done
mercelino opened this issue Nov 5, 2024 · 0 comments
Open
1 task done
Labels
feature Features or general enhancements

Comments

@mercelino
Copy link

Is your feature request related to a problem?

the method sort() does not have an option to sort in a descending way, it sorts only in an ascending way by default
Although the option to sort in a descending way does exist in DuckDB as well: https://duckdb.org/docs/sql/functions/list#sorting-lists

What is the motivation behind your request?

I am converting from writing raw SQL in python using string for DuckDB backend to using Ibis in order to increase readability and having the ability to switch to other backends.

Describe the solution you'd like

i would be able to do table.column.mode()
Example:
t = ibis.memtable(
... {
... "id": range(3),
... "arr": [
... [1, 2, 3, 3],
... [1, 1, 2, 2, 3, 4],
... [1, 1, 2 ,3]
... ],
... }
... )

The output of t.arr.sort('asc') would be the same as the output of the current method, so the 'asc' can be the argument by default.

The output of t.arr.sort('desc') would be a column of the following elements [[3, 3, 2, 1], [4, 3, 2, 2, 1, 1], [3, 2, 1, 1]]

What version of ibis are you running?

9.5.0

What backend(s) are you using, if any?

DuckDB

Code of Conduct

  • I agree to follow this project's Code of Conduct
@mercelino mercelino added the feature Features or general enhancements label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Features or general enhancements
Projects
Status: backlog
Development

No branches or pull requests

1 participant