-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: support customizing column default values for inserting #8283
Conversation
@@ -230,6 +231,41 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { | |||
Ok(Schema::new(fields)) | |||
} | |||
|
|||
pub(super) fn build_column_defaults( |
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.
would be nice to explain in comments what exactly gets returned in the tuple for future readers, like <column name, expr>
I'm even thinking should be that be a map instead of Vec<>
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.
A comment has been added for this.
The main reason is that Hashmap
has not implemented the Hash
trait, which is required by CreateMemoryTable
.
Thanks @jonahgao I think we're very close |
Co-authored-by: comphead <comphead@users.noreply.github.com>
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.
lgtm thanks @jonahgao for supporting custom default values
Thank you for reviewing @comphead |
Which issue does this PR close?
This is a continuation of #8146.
Rationale for this change
Currently, we only support NULL as the default value for columns.
This pr will enable users to customize the default value while creating a table.
For example:
What changes are included in this PR?
CreateMemoryTable
plan.TableSource
.MemTable
for verification.Are these changes tested?
Yes
Are there any user-facing changes?
Yes.
TableSource
andTableProvider
, but provided default implementations.column_defaults
in the structCreateMemoryTable
.