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

SQL: support dot notation for struct accessor #2983

Open
jaychia opened this issue Oct 1, 2024 · 1 comment
Open

SQL: support dot notation for struct accessor #2983

jaychia opened this issue Oct 1, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request sql

Comments

@jaychia
Copy link
Contributor

jaychia commented Oct 1, 2024

Describe the bug

image

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 jaychia added bug Something isn't working needs triage labels Oct 1, 2024
@universalmind303
Copy link
Collaborator

@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()

@universalmind303 universalmind303 changed the title SQL filter does not do struct accessor SQL: support dot notation for struct accessor Oct 1, 2024
@universalmind303 universalmind303 added enhancement New feature or request and removed bug Something isn't working labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sql
Projects
None yet
Development

No branches or pull requests

2 participants