-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: fill missing values with NULLs while inserting #8146
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -422,12 +422,11 @@ CopyTo: format=csv output_url=output.csv single_file_output=true options: () | |
| fn plan_insert() { | ||
| let sql = | ||
| "insert into person (id, first_name, last_name) values (1, 'Alan', 'Turing')"; | ||
| let plan = r#" | ||
| Dml: op=[Insert Into] table=[person] | ||
| Projection: CAST(column1 AS UInt32) AS id, column2 AS first_name, column3 AS last_name | ||
| Values: (Int64(1), Utf8("Alan"), Utf8("Turing")) | ||
| "# | ||
| .trim(); | ||
| let plan = "Dml: op=[Insert Into] table=[person]\ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
| \n Projection: CAST(column1 AS UInt32) AS id, column2 AS first_name, column3 AS last_name, \ | ||
| CAST(NULL AS Int32) AS age, CAST(NULL AS Utf8) AS state, CAST(NULL AS Float64) AS salary, \ | ||
| CAST(NULL AS Timestamp(Nanosecond, None)) AS birth_date, CAST(NULL AS Int32) AS 😀\ | ||
| \n Values: (Int64(1), Utf8(\"Alan\"), Utf8(\"Turing\"))"; | ||
| quick_test(sql, plan); | ||
| } | ||
|
|
||
|
|
@@ -4037,12 +4036,11 @@ Dml: op=[Update] table=[person] | |
| fn test_prepare_statement_insert_infer() { | ||
| let sql = "insert into person (id, first_name, last_name) values ($1, $2, $3)"; | ||
|
|
||
| let expected_plan = r#" | ||
| Dml: op=[Insert Into] table=[person] | ||
| Projection: column1 AS id, column2 AS first_name, column3 AS last_name | ||
| Values: ($1, $2, $3) | ||
| "# | ||
| .trim(); | ||
| let expected_plan = "Dml: op=[Insert Into] table=[person]\ | ||
| \n Projection: column1 AS id, column2 AS first_name, column3 AS last_name, \ | ||
| CAST(NULL AS Int32) AS age, CAST(NULL AS Utf8) AS state, CAST(NULL AS Float64) AS salary, \ | ||
| CAST(NULL AS Timestamp(Nanosecond, None)) AS birth_date, CAST(NULL AS Int32) AS 😀\ | ||
| \n Values: ($1, $2, $3)"; | ||
|
|
||
| let expected_dt = "[Int32]"; | ||
| let plan = prepare_stmt_quick_test(sql, expected_plan, expected_dt); | ||
|
|
@@ -4061,12 +4059,11 @@ Dml: op=[Insert Into] table=[person] | |
| ScalarValue::Utf8(Some("Alan".to_string())), | ||
| ScalarValue::Utf8(Some("Turing".to_string())), | ||
| ]; | ||
| let expected_plan = r#" | ||
| Dml: op=[Insert Into] table=[person] | ||
| Projection: column1 AS id, column2 AS first_name, column3 AS last_name | ||
| Values: (UInt32(1), Utf8("Alan"), Utf8("Turing")) | ||
| "# | ||
| .trim(); | ||
| let expected_plan = "Dml: op=[Insert Into] table=[person]\ | ||
| \n Projection: column1 AS id, column2 AS first_name, column3 AS last_name, \ | ||
| CAST(NULL AS Int32) AS age, CAST(NULL AS Utf8) AS state, CAST(NULL AS Float64) AS salary, \ | ||
| CAST(NULL AS Timestamp(Nanosecond, None)) AS birth_date, CAST(NULL AS Int32) AS 😀\ | ||
| \n Values: (UInt32(1), Utf8(\"Alan\"), Utf8(\"Turing\"))"; | ||
| let plan = plan.replace_params_with_values(¶m_values).unwrap(); | ||
|
|
||
| prepare_stmt_replace_params_quick_test(plan, param_values, expected_plan); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the new name
value_indiciesmuch better