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

Enhancing INSERT Command to Support Inserting Multiple Values #1421

Conversation

anmolagarwalcp810
Copy link
Contributor

@anmolagarwalcp810 anmolagarwalcp810 commented Nov 26, 2023

Problem Statement

INSERT command wasn't inserting multiple values into table. It was only inserting the first tuple and ignoring everything else.
image

Solution

Modified backend of INSERT command by finding out two things:

  1. Place where other tuples are dropped except the first one. That happened inside parser/lark_visitor/_insert_statements.py.
  2. Place where INSERT command is actually executed, and does it support inserting multiple tuples and it does, executor/insert_executor.py.

After find those two things, I simply captured all the tuples coming from the tree created by Lark, and passed them to the executor through the planner. Tried to make sure that there are no issues inside planner because of that.

I also modified hash functions of InsertTableStatement, InsertPlan and LogicalInsert classes because value_list member became 2-dimensional after my change, and couldn't be hashed. So I converted each element of value_list to tuple, and then hash functions were working.

Output after enhancing INSERT command

image

@anmolagarwalcp810 anmolagarwalcp810 changed the title Users/anmolagarwal/insert bug fix Enhancing INSERT Command to Support Multiple Values Nov 26, 2023
@anmolagarwalcp810 anmolagarwalcp810 changed the title Enhancing INSERT Command to Support Multiple Values Enhancing INSERT Command to Support Inserting Multiple Values Nov 26, 2023
@anmolagarwalcp810
Copy link
Contributor Author

anmolagarwalcp810 commented Nov 26, 2023

Also, all test cases passed locally, except these two:
FAILED test/integration_tests/long/test_create_table_executor.py::CreateTableTest::test_should_create_table_from_select_lateral_join - AssertionError: False is not true
FAILED test/unit_tests/test_eva_cmd_client.py::CMDClientTest::test_evadb_client - RuntimeError: There is no current event loop in thread 'MainThread'.
However, when I ran each of them individually in visual code pytests, each of them passed without any issues. Not sure, why they weren't working when running them in bundle.

Copy link
Collaborator

@xzdandy xzdandy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding inserting multiple value support.

@xzdandy xzdandy merged commit c2457b2 into georgia-tech-db:staging Dec 1, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants