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

Adding field access to function calls gets ignored by SQL parser #2967

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

Adding field access to function calls gets ignored by SQL parser #2967

wjones127 opened this issue Oct 1, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wjones127
Copy link
Contributor

For some reason, when we pass a query like SELECT func(a).x FROM t, the tokens . and x are ignored and it just parses as func(a) into a DataFusion expression. I couldn't reproduce with basic sqlparser. I think something is messed up with our dialect implementation.

This means in particular that array_element(list_struct, 1).y gets parsed into array_element(list_struct, 1), dropping the .y.

In #2966 we work around this by supporting field access by ['y'] instead.

@wjones127 wjones127 added the bug Something isn't working label Oct 1, 2024
@ion-elgreco
Copy link

Did you try encapsulating it with backticks?

wjones127 added a commit that referenced this issue Oct 2, 2024
Adds support for accessing list items and struct fields with
subscripting: `x[0]` and `x['field_name']`. These can be chained.

Unfortunately there is an issue with our SQL parser related to using `.`
I wasn't able to figure out. Follow up issue here:
#2967
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants