Skip to content

Fix error in addMonths with floating point argument#12018

Merged
akuzm merged 1 commit intomasterfrom
fix-bad-get-datetime
Jun 29, 2020
Merged

Fix error in addMonths with floating point argument#12018
akuzm merged 1 commit intomasterfrom
fix-bad-get-datetime

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):
When adding floating point number of intervals to date/datetime, the result may be calculated incorrectly. This fixes #11377.

Detailed description:

It is rounded to integer.
You may consider more sophisticated logic but it's way more difficult (say add 1.5 months).


if (const auto * delta_const_column = typeid_cast<const ColumnConst *>(&delta_column))
op.vectorConstant(sources->getData(), col_to->getData(), delta_const_column->getField().get<Int64>(), time_zone);
op.vectorConstant(sources->getData(), col_to->getData(), delta_const_column->getInt(0), time_zone);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugfix is in this line.

@blinkov blinkov added the pr-bugfix Pull request with bugfix, not backported by default label Jun 28, 2020
@akuzm akuzm merged commit 4685716 into master Jun 29, 2020
@akuzm akuzm deleted the fix-bad-get-datetime branch June 29, 2020 13:04
@akuzm akuzm self-assigned this Jun 29, 2020
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 pr-no-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

addMonths: Field::get: assertion failed

3 participants