Enhancing INSERT Command to Support Inserting Multiple Values #1421
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Statement
INSERT command wasn't inserting multiple values into table. It was only inserting the first tuple and ignoring everything else.
Solution
Modified backend of INSERT command by finding out two things:
parser/lark_visitor/_insert_statements.py
.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