[Opt](function) Optimize the performance of FROM_UNIXTIME#57423
Merged
morningman merged 1 commit intoapache:masterfrom Oct 31, 2025
Merged
[Opt](function) Optimize the performance of FROM_UNIXTIME#57423morningman merged 1 commit intoapache:masterfrom
morningman merged 1 commit intoapache:masterfrom
Conversation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
27b1a0c to
a1984de
Compare
Contributor
Author
|
run buildall |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
zclllyybb
approved these changes
Oct 28, 2025
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
ClickBench: Total hot run time: 27.89 s |
morningman
approved these changes
Oct 31, 2025
morningman
pushed a commit
that referenced
this pull request
Oct 31, 2025
yiguolei
pushed a commit
that referenced
this pull request
Nov 5, 2025
16 tasks
morningman
pushed a commit
that referenced
this pull request
Nov 15, 2025
### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: The construction cost of civil_second in cctz is expensive, details can be seen: #57423. In some cases, we do not need to construct the complete civil_time, but only the UTC offset is required, like:`HOUR(FROM_UNIXTIME(ts))` This PR supports the lookup_offset function in cctz, which has the same return type as lookup, but the civil_second is empty, avoiding the expensive construction cost. ```cpp return {{}, utc_offset, is_dst, abbreviations[abbr_index]}; ```
github-actions bot
pushed a commit
that referenced
this pull request
Nov 15, 2025
### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: The construction cost of civil_second in cctz is expensive, details can be seen: #57423. In some cases, we do not need to construct the complete civil_time, but only the UTC offset is required, like:`HOUR(FROM_UNIXTIME(ts))` This PR supports the lookup_offset function in cctz, which has the same return type as lookup, but the civil_second is empty, avoiding the expensive construction cost. ```cpp return {{}, utc_offset, is_dst, abbreviations[abbr_index]}; ```
github-actions bot
pushed a commit
that referenced
this pull request
Nov 15, 2025
### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: The construction cost of civil_second in cctz is expensive, details can be seen: #57423. In some cases, we do not need to construct the complete civil_time, but only the UTC offset is required, like:`HOUR(FROM_UNIXTIME(ts))` This PR supports the lookup_offset function in cctz, which has the same return type as lookup, but the civil_second is empty, avoiding the expensive construction cost. ```cpp return {{}, utc_offset, is_dst, abbreviations[abbr_index]}; ```
nagisa-kunhah
pushed a commit
to nagisa-kunhah/doris
that referenced
this pull request
Dec 14, 2025
…e#57999) ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: The construction cost of civil_second in cctz is expensive, details can be seen: apache#57423. In some cases, we do not need to construct the complete civil_time, but only the UTC offset is required, like:`HOUR(FROM_UNIXTIME(ts))` This PR supports the lookup_offset function in cctz, which has the same return type as lookup, but the civil_second is empty, avoiding the expensive construction cost. ```cpp return {{}, utc_offset, is_dst, abbreviations[abbr_index]}; ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Before:
After:
In from_unixtime, we use
cctz::convertto transform an unix timestamp into timezone-specific local time, the calculation formula is as follows:tr.civil_sec + (unix_time-tr.unix_time). This step involves a complex calculation with the addition operator to adjust the civil day accordingly like:Solution:
Pseudo code:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)