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

Binder error when external data source has a table with uppercase column name #1079

Open
1 of 2 tasks
xzdandy opened this issue Sep 8, 2023 · 3 comments · Fixed by #1091
Open
1 of 2 tasks

Binder error when external data source has a table with uppercase column name #1079

xzdandy opened this issue Sep 8, 2023 · 3 comments · Fixed by #1091
Assignees
Labels
Bug 🐞 EVA is not working as expected Crash 💥 EVA is crashing
Milestone

Comments

@xzdandy
Copy link
Collaborator

xzdandy commented Sep 8, 2023

Search before asking

  • I have searched the EvaDB issues and found no similar bug report.

Bug

Example home_sales table in sqlite3:

    home_sales.saledate home_sales.MA home_sales.type home_sales.bedrooms
0              saledate            MA            type            bedrooms
1            30/09/2007        441854           house                   2
2            31/12/2007        441854           house                   2
3            31/03/2008        441854           house                   2
4            30/06/2008        441854           house                   2
..                  ...           ...             ...                 ...
343          30/09/2018        603281            unit                   3
344          31/12/2018        601167            unit                   3
345          31/03/2019        605637            unit                   3
346          30/06/2019        599339            unit                   3
347          30/09/2019        597884            unit                   3

When we run the following query in EvaDB:

SELECT * FROM sqlite_date.home_sales; 

It crashed with the following error message

Traceback (most recent call last):
  File "/home/zxu330/eva/evadb/executor/plan_executor.py", line 178, in execute_plan
    yield from output
  File "/home/zxu330/eva/evadb/executor/project_executor.py", line 34, in exec
    batch = apply_project(batch, self.target_list, self.catalog())
  File "/home/zxu330/eva/evadb/executor/executor_utils.py", line 42, in apply_project
    batches = [expr.evaluate(batch) for expr in project_list]
  File "/home/zxu330/eva/evadb/executor/executor_utils.py", line 42, in <listcomp>
    batches = [expr.evaluate(batch) for expr in project_list]
  File "/home/zxu330/eva/evadb/expression/tuple_value_expression.py", line 71, in evaluate
    return batch.project([self.col_alias])
  File "/home/zxu330/eva/evadb/models/storage/batch.py", line 246, in project
    assert len(unknown_cols) == 0, unknown_cols
AssertionError: ['home_sales.ma']

As we can see, the binder is looking for column home_sales.ma instead of home_sales.MA.

Environment

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@xzdandy xzdandy added Bug 🐞 EVA is not working as expected Crash 💥 EVA is crashing labels Sep 8, 2023
@xzdandy xzdandy changed the title Binder error when external data source has a table with capital column name Binder error when external data source has a table with uppercase column name Sep 8, 2023
@xzdandy
Copy link
Collaborator Author

xzdandy commented Sep 8, 2023

node.col_alias = "{}.{}".format(table_alias, node.name.lower()) at evadb/binder/statement_binder.py makes the column name to lowercase that caused this issue.

@gaurav274 What is the motivation to turn the column name into lower case in alias instead of keeping it as original?

@americast
Copy link
Member

@xzdandy @gaurav274 The issue seems to still persists:

In [3]: cursor.query("CREATE TABLE ABC(\                                                                                                              
   ...: HELLO INTEGER);").execute()                                                                                                                   
Out[3]: <evadb.models.storage.batch.Batch at 0x7fe0fc4c3bd0>               
                                                                           
In [4]: print(cursor.query("SELECT HELLO FROM ABC;").df())                                                                                            
09-28-2023 22:30:06 ERROR [statement_binder_context:statement_binder_context.py:raise_error:0145] Found invalid column hello

@americast americast reopened this Sep 29, 2023
@xzdandy
Copy link
Collaborator Author

xzdandy commented Sep 29, 2023

Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 EVA is not working as expected Crash 💥 EVA is crashing
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants