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(Impala): support .distinct() for a subset of columns #10370

Open
1 task done
contang0 opened this issue Oct 25, 2024 · 2 comments
Open
1 task done

feat(Impala): support .distinct() for a subset of columns #10370

contang0 opened this issue Oct 25, 2024 · 2 comments
Labels
feature Features or general enhancements

Comments

@contang0
Copy link

contang0 commented Oct 25, 2024

Is your feature request related to a problem?

At the moment Impala backend only supports .distinct() on a full table.

This works:

table.distinct()

This does not:

table.distinct(on=['col1', 'col2'])

Translation to backend failed
Error message: OperationNotDefinedError("Compilation rule for 'First' operation is not defined")

What is the motivation behind your request?

This forces me to write verbose workarounds.

.distinct() on a subset of a table is pretty fundamental, in my view.

Describe the solution you'd like

The on clause in .distinct() should work.

What version of ibis are you running?

10.5

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

Impala

Code of Conduct

  • I agree to follow this project's Code of Conduct
@contang0 contang0 added the feature Features or general enhancements label Oct 25, 2024
@NickCrews
Copy link
Contributor

workaround in the meantime should be something like

def distinct(t, on):
    aggs = {col: t[col].arbitrary() for col in t.columns if col not in on}
    return t. group_by(on).agg(**aggs)

@contang0
Copy link
Author

Thank you, will give it a try!

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

2 participants