Daft icon indicating copy to clipboard operation
Daft copied to clipboard

* and '*' not handled correctly in SQL planner

Open desmondcheongzx opened this issue 8 months ago • 0 comments

Describe the bug

import daft

df = daft.from_pydict({
    "person": [
        {"name": "Alice", "age": 30},
        {"name": "Bob", "age": 25},
        {"name": "Charlie", "age": 35}
    ]
})

daft.sql("SELECT person.'*' FROM df").show()
# ╭───────┬─────────╮
# │ age   ┆ name    │
# │ ---   ┆ ---     │
# │ Int64 ┆ Utf8    │
# ╞═══════╪═════════╡
# │ 30    ┆ Alice   │
# ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
# │ 25    ┆ Bob     │
# ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┤
# │ 35    ┆ Charlie │
# ╰───────┴─────────╯
# (Showing first 3 of 3 rows)

This treats the string literal '*' as the special * token. At the same time,

daft.sql("SELECT person.* FROM df").show()

does not correctly handle the * special token and throws daft.exceptions.InvalidSQLException: Table not found: person 😅

Component(s)

SQL

Additional context

No response

desmondcheongzx avatar Mar 31 '25 22:03 desmondcheongzx