-
Notifications
You must be signed in to change notification settings - Fork 761
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(query): Virtual column support alias name #17365
Conversation
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.
Reviewed 43 of 43 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @b41sh and @sundy-li)
src/meta/protos/proto/virtual_column.proto
line 50 at r1 (raw file):
// if true, virtual columns are auto generated, // otherwise virtual columns are created by user. optional bool auto_generated = 7;
This is explicitly set to be an Option
. What does it mean if it is None
? I see that None
is replaced with the default value false
thus optional
seems to be unnecessary?
src/meta/app/src/schema/virtual_column.rs
line 52 at r1 (raw file):
} #[derive(serde::Serialize, serde::Deserialize, Clone, Debug, Eq, PartialEq)]
Why do VirtualColumnMeta
and VirtualField
need serde
?
src/meta/app/src/schema/virtual_column.rs
line 59 at r1 (raw file):
pub created_on: DateTime<Utc>, pub updated_on: Option<DateTime<Utc>>, pub auto_generated: bool,
This field needs to be explained about its purpose and usage.
src/meta/proto-conv/src/virtual_column_from_to_protobuf_impl.rs
line 62 at r1 (raw file):
}; let alias_name = if let Some(alias_name) = p.alias_names.get(i) { if !alias_name.is_empty() {
I do believe any string including empty string ""
could be a valid name. 🤔
45e1d20
to
4705cc8
Compare
4705cc8
to
80924ae
Compare
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.
Cleaner and simpler! Good job!
Reviewed 7 of 7 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @b41sh)
src/meta/protos/proto/virtual_column.proto
line 47 at r2 (raw file):
// virtual column alias names, // key is the index of `virtual_columns` field. map<uint64, string> alias_names = 6;
Nice shot! Using a map significantly simplified the data conversion logic.
src/meta/app/src/schema/virtual_column.rs
line 75 at r2 (raw file):
pub updated_on: Option<DateTime<Utc>>, // Whether the virtual columns are auto-generated, // true for auto-generated, false for user-defined.
I think it's meant to be:
Suggestion:
// Whether the virtual column alias names are auto-generated,
// true for auto-generated, false for user-defined.
Thanks for the review. @drmingdrmer |
Then everything is good to me :) |
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
virtual columns allow set alias names, user can use alias name to query variant inner column
for example:
Tests
Type of change
This change is