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

feat: fill missing values with NULLs while inserting #8146

Merged
merged 3 commits into from
Nov 14, 2023

Conversation

jonahgao
Copy link
Member

Which issue does this PR close?

Closes #8091.

Rationale for this change

If user does not provide a value for certain columns during insertion, NULL will be filled as their default values.

What changes are included in this PR?

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added sql SQL Planner sqllogictest SQL Logic Tests (.slt) labels Nov 13, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution @jonahgao -- it looks really nice to me as always.

cc @avantgardnerio

@@ -1098,7 +1103,7 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
.collect::<Vec<_>>(),
)
} else {
let mut mapping = vec![None; table_schema.fields().len()];
let mut value_indices = vec![None; table_schema.fields().len()];
Copy link
Contributor

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_indicies much better

Values: (Int64(1), Utf8("Alan"), Utf8("Turing"))
"#
.trim();
let plan = "Dml: op=[Insert Into] table=[person]\
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@alamb alamb merged commit 64057fd into apache:main Nov 14, 2023
22 checks passed
@alamb
Copy link
Contributor

alamb commented Nov 14, 2023

Thanks @jonahgao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sql SQL Planner sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

INSERT INTO does not allow to insert only specified columns
2 participants