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

Column names with spaces fail in WHERE clause [.xlsx] #240

Closed
b-schmeling opened this issue Jan 26, 2024 · 2 comments · Fixed by #249
Closed

Column names with spaces fail in WHERE clause [.xlsx] #240

b-schmeling opened this issue Jan 26, 2024 · 2 comments · Fixed by #249
Labels
bug Something isn't working

Comments

@b-schmeling
Copy link

b-schmeling commented Jan 26, 2024

If you load a .xlsx where one of the column names has spaces, you can use it in a SELECT clause but not in a WHERE clause.

Repro: Use this excel file:
samsung_sales.xlsx

Run:

INSTALL spatial; LOAD spatial;
SELECT * FROM st_read('samsung_sales.xlsx', layer='Orders') WHERE \"Unit Selling Price\" > 14 LIMIT 10;

or this script if preferred:
excel_col_space.py.zip

Using DuckDB 0.9.2. Also did not work with installing nightly spatial.

Error:

Invalid Input Error: Attempting to execute an unsuccessful or closed pending query result
Error: IO Error: GDAL Error (1): SQL Expression Parsing Error: syntax error, unexpected identifier, expecting end of string. Occurred around :
Unit Selling Price>14 AND Unit Selling Price
^
[SQL: SELECT * FROM st_read('samsung_sales.xlsx', layer='Orders') WHERE "Unit Selling Price" > 14 LIMIT 10;]

@aborruso
Copy link
Contributor

aborruso commented Feb 4, 2024

I confirm it :(

@Maxxen
Copy link
Member

Maxxen commented Feb 4, 2024

Hi! Thanks for reporting this issue. It seems like we need to add additional quoutes/escapes when pushing down filters into the GDAL scan. Will look into fixing it!

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

Successfully merging a pull request may close this issue.

3 participants