Skip to content

bug/feat: Non-Value objects error with .get_name() #10450

Closed as not planned
Closed as not planned
@NickCrews

Description

@NickCrews

What happened?

Not sure what intended behavior is here, but there is a papercut: #10246 makes it sound like we expect anything with a .get_name() to actually work. But I think that all ir.Values have a name, but not all ir.Exprs do:

import ibis

t = ibis.memtable({"x": [1, 2, 3]})
t.get_name()  # ibis_pandas_memtable_2ltmalss6jcxvbo57dr753xrky
t.filter(t.x > 1).get_name()  # AttributeError: 'Filter' object has no attribute 'name'
t.union(t).get_name()  # AttributeError: 'Union' object has no attribute 'name'
t.select("x").get_name()  # AttributeError: 'Project' object has no attribute 'name'

I think there are two solutions?

  1. make ALL ir.Values be named, autogenerating one if not set explicitly, similar to ir.Values
  2. only support ir.Values being named, and move the method from ir.Expr to ir.Value, so that users don't get tab completion on this method that can sometimes fail.

Since in the above t.get_name() works, getting the name of the physical table in the backend, and I think this is useful, I would lean towards 1?

What version of ibis are you using?

main

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

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior inside of ibis

    Type

    No type

    Projects

    Status

    done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions