-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[improvement](function) add timezone cache for convert_tz #14616
Conversation
TeamCity pipeline, clickbench performance test result: |
902afd5
to
5090d40
Compare
2697030
to
d764011
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.
LGTM
PR approved by anyone and no changes requested. |
d764011
to
f557105
Compare
f557105
to
cced55f
Compare
@@ -47,6 +51,10 @@ struct ConvertTZImpl { | |||
const ColumnString* from_tz_column, const ColumnString* to_tz_column, | |||
ReturnColumnType* result_column, NullMap& result_null_map, | |||
size_t input_rows_count) { | |||
auto convert_ctx = reinterpret_cast<ConvertTzCtx*>( | |||
context->get_function_state(FunctionContext::FunctionStateScope::THREAD_LOCAL)); | |||
std::map<StringRef, cctz::time_zone> time_zone_cache_; |
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.
std::map<StringRef, cctz::time_zone> time_zone_cache_; | |
std::map<StringRef, cctz::time_zone> time_zone_cache; |
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.
time_zone_cache_
is a temporary map.
time_zone_cache
is a reference to the map.
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
Proposed changes
cctz::fixed_time_zone
will lock&unlock the mutex in each call, this is a non-negligible performance cost.This PR adds a map to cache the timezone to avoid finding the same timezone repeatedly.
Problem summary
Describe your changes.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...