lancedb / lance

Modern columnar data format for ML and LLMs implemented in Rust. Convert from parquet in 2 lines of code for 100x faster random access, vector index, and data versioning. Compatible with Pandas, DuckDB, Polars, Pyarrow, with more integrations coming..
https://lancedb.github.io/lance/
Apache License 2.0
3.85k stars 212 forks source link

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

Open wjones127 opened 1 week ago

wjones127 commented 1 week ago

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.

ion-elgreco commented 1 week ago

Did you try encapsulating it with backticks?