- 
                Notifications
    
You must be signed in to change notification settings  - Fork 328
 
Open
Labels
bugSomething isn't workingSomething isn't workingp2 (backlog)Nice to have featuresNice to have features
Description
Describe the bug
Instead of returning the names of the fields from a struct, the original name is applied to multiple columns yielding an ambiguous column reference error when selecting on "result' or no column name found on "bar'.
To Reproduce
import daft 
@daft.cls()
class Foo:
    def __init__(self, x: str):
         self.x = x
    @daft.method(
        return_dtype=daft.DataType.struct({
            "bar": daft.DataType.string(),
            "some_int": daft.DataType.int64(),
        }),
        unnest=True
    )
    def do_something(self, input: str):
        return {
            "bar": input + self.x,
            "some_int": 3,
        }
foobar = Foo("bar")
df = daft.from_pydict({"input": ["daft is cool"]}).with_column("result", foobar.do_something(daft.col("input")))
df.show()
# Returns 
╭──────────────┬─────────────────┬────────╮
│ input        ┆ result          ┆ result │
│ ---          ┆ ---             ┆ ---    │
│ String       ┆ String          ┆ Int64  │
╞══════════════╪═════════════════╪════════╡
│ daft is cool ┆ daft is coolbar ┆ 3      │
╰──────────────┴─────────────────┴────────╯Expected behavior
Should return
╭──────────────┬─────────────────┬──────────╮
│ input        ┆ bar             ┆ some_int │
│ ---          ┆ ---             ┆ ---      │
│ String       ┆ String          ┆ Int64    │
╞══════════════╪═════════════════╪══════════╡
│ daft is cool ┆ daft is coolbar ┆ 3        │
╰──────────────┴─────────────────┴──────────╯
Component(s)
Other
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingp2 (backlog)Nice to have featuresNice to have features