Daft
Daft copied to clipboard
SQL: support dot notation for struct accessor
Describe the bug
It seems that in a filter our SQL parser treats accessing . as accessing a table instead of my intention which is to treat it as accessing a struct field
To Reproduce
No response
Expected behavior
No response
Component(s)
SQL
Additional context
No response
@jaychia currently our struct access only supports bracket notation, not dot notation.
give this a try!
import daft
df = daft.from_pydict(
{
"source": [{"database": "db1", "table": "table1"}, {"database": "db2", "table": "table2"}],
"size": [{"depth": 3}, {"depth": 4}]
}
)
daft.sql("select source['database'] from df WHERE size['depth'] != 3").collect()
Closed, but we need better docs around this I think