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

bug: .distinct(on="does_not_exist") does not crash #6237

Closed
1 task done
NickCrews opened this issue May 18, 2023 · 1 comment · Fixed by #6301
Closed
1 task done

bug: .distinct(on="does_not_exist") does not crash #6237

NickCrews opened this issue May 18, 2023 · 1 comment · Fixed by #6301
Labels
bug Incorrect behavior inside of ibis
Milestone

Comments

@NickCrews
Copy link
Contributor

What happened?

ibis.examples.topo.fetch().distinct(on="does_not_exist")

I would expect this to error.

What version of ibis are you using?

5.1.0, have not tested on main

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

duckdb, but probably irrelevant?

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@NickCrews NickCrews added the bug Incorrect behavior inside of ibis label May 18, 2023
@cpcloud cpcloud added this to the 6.0 milestone May 18, 2023
@mesejo
Copy link
Contributor

mesejo commented May 23, 2023

I think the problem is in the GroupedTable constructor, it allows self.by to be empty:

    def __init__(
        self, table, by, having=None, order_by=None, window=None, **expressions
    ):
        self.table = table
        self.by = list(
            itertools.chain(
                itertools.chain.from_iterable(
                    _get_group_by_key(table, v) for v in util.promote_list(by)
                ),
                (
                    expr.name(k)
                    for k, v in expressions.items()
                    for expr in _get_group_by_key(table, v)
                ),
            )
        )
        self._order_by = order_by or []
        self._having = having or []
        self._window = window

mesejo added a commit to mesejo/ibis that referenced this issue May 24, 2023
mesejo added a commit to mesejo/ibis that referenced this issue May 24, 2023
mesejo added a commit to mesejo/ibis that referenced this issue May 24, 2023
mesejo added a commit to mesejo/ibis that referenced this issue May 25, 2023
mesejo added a commit to mesejo/ibis that referenced this issue May 25, 2023
mesejo added a commit to mesejo/ibis that referenced this issue May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants