Skip to content
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

Preserve timezone in arithmetic operations on DateTime #9323

Merged
merged 12 commits into from
Mar 12, 2020

Conversation

alexey-milovidov
Copy link
Member

Changelog category (leave one):

  • Bug Fix

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fixed the issue: timezone was not preserved if you write a simple arithmetic expression like time + 1 (in contrast to an expression like time + INTERVAL 1 SECOND). This fixes #5743

@alexey-milovidov
Copy link
Member Author

Performance test is failed, need to fix.

@alexey-milovidov
Copy link
Member Author

Still need to fix two queries in perf test.

@alexey-milovidov
Copy link
Member Author

The code is absolutely the same but this PR is up to 10% worse:

SELECT count() FROM system.numbers WHERE NOT ignore(toDateTime('2017-01-01 00:00:00') + number)

Bad: 855.21 million rows/s.

AddSecondsImpl constant_vector

 14.85 │50:   movdqu (%rdx,%rax,2),%xmm0
 46.97 │      movdqu 0x10(%rdx,%rax,2),%xmm2
 10.61 │      shufps $0x88,%xmm2,%xmm0
  7.88 │      paddd  %xmm1,%xmm0
 19.70 │      movups %xmm0,(%rsi,%rax,1)

Good: 933.69 million rows/s.

BinaryOperationImplBase constant_vector

 17.81 │28:   movdqu (%rsi,%rax,2),%xmm0
 44.89 │      movdqu 0x10(%rsi,%rax,2),%xmm2
 11.88 │      shufps $0x88,%xmm2,%xmm0
  6.89 │      paddd  %xmm1,%xmm0
 18.53 │      movups %xmm0,(%rdx,%rax,1)

@alexey-milovidov alexey-milovidov force-pushed the datetime-arithmetic-preserve-timezone branch from 3151d01 to 91856dc Compare March 12, 2020 14:17
@alexey-milovidov
Copy link
Member Author

The code is absolutely the same but this PR is up to 10% worse

I decided that it's bearable.

@alexey-milovidov alexey-milovidov merged commit 94dabe3 into master Mar 12, 2020
@alexey-milovidov alexey-milovidov deleted the datetime-arithmetic-preserve-timezone branch March 12, 2020 14:19
@robot-clickhouse robot-clickhouse added the pr-bugfix Pull request with bugfix, not backported by default label Mar 16, 2020
KochetovNicolai pushed a commit that referenced this pull request Mar 16, 2020
…-timezone

Preserve timezone in arithmetic operations on DateTime

(cherry picked from commit 94dabe3)
KochetovNicolai pushed a commit that referenced this pull request Mar 16, 2020
…-timezone

Preserve timezone in arithmetic operations on DateTime

(cherry picked from commit 94dabe3)
KochetovNicolai pushed a commit that referenced this pull request Mar 16, 2020
…-timezone

Preserve timezone in arithmetic operations on DateTime

(cherry picked from commit 94dabe3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix Pull request with bugfix, not backported by default
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arithmetic operation on DateTime doesn't save time zone.
5 participants