-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Refactoring of virtual columns #60205
Conversation
…/ClickHouse into refactor-virtual-columns
This is an automated comment for commit c887833 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page Successful checks
|
8889a70
to
0fa22ab
Compare
dd400de
to
1b9e6c9
Compare
NamesAndTypesList result_virtuals; | ||
std::set_difference( | ||
default_virtuals.begin(), default_virtuals.end(), storage_columns.begin(), storage_columns.end(), | ||
std::back_inserter(result_virtuals), | ||
[](const NameAndTypePair & lhs, const NameAndTypePair & rhs){ return lhs.name < rhs.name; }); |
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.
So, the lexicographical order is guaranteed by the VirtualColumnsDescription::Container
? Looks nice!
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.
It's not guaranteed, but it's not needed either.
auto it = container.get<1>().find(name); | ||
if (it != container.get<1>().end() && (static_cast<UInt8>(it->kind) & static_cast<UInt8>(kind))) |
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.
nit: std::find_if
?
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.
In general I don't like it and here it will be more cumbersome, I think.
if (all_columns.has(command.column_name) || | ||
all_columns.hasNested(command.column_name) || | ||
(command.clear && column_name == LightweightDeleteDescription::FILTER_COLUMN.name)) | ||
if (all_columns.has(command.column_name) || all_columns.hasNested(command.column_name)) |
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.
Was the condition command.clear && column_name == LightweightDeleteDescription::FILTER_COLUMN.name)
superfluous?
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.
Yes, it was superfluous. It was never satisfied because the query always fails earlier and it's the expected behaviour, I think.
: DB::IStorageSystemOneBlock<StorageSystemDictionaries>(storage_id_) | ||
{ | ||
VirtualColumnsDescription virtuals; | ||
virtuals.addEphemeral("key", std::make_shared<DataTypeString>(), ""); |
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.
Not related to the diff, but seems that the name "key" violates the naming convention for virtual columns?
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.
Yes, but let's not introduce backward incompatibility.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Improved overall usability of virtual columns. Now it is allowed to use virtual columns in
PREWHERE
(it's worthwhile for non-const virtual columns like_part_offset
). Now a builtin documentation is available for virtual columns as a comment of column inDESCRIBE
query with enabled settingdescribe_include_virtual_columns
.Includes #59033.
Fixes #60685.