Skip to content

[CALCITE-3881] SqlFunctions#addMonths yields incorrect results in som…#1890

Closed
docete wants to merge 2 commits into
apache:masterfrom
docete:CALCITE-3881
Closed

[CALCITE-3881] SqlFunctions#addMonths yields incorrect results in som…#1890
docete wants to merge 2 commits into
apache:masterfrom
docete:CALCITE-3881

Conversation

@docete

@docete docete commented Mar 30, 2020

Copy link
Copy Markdown
Contributor

…e corner case

SqlFunctions#addMonths use DateTimeUtils#ymdToUnixDate to calculate the JDN(julian day number). But in some corner cases it yields incorrent results. The root cause is: the algorithm of DateTimeUtils#ymdToUnixDate requires reasonable month(1 to 12)[1], but SqlFunctions#addMonths may pass in a month out of the reasonable range. This PR will fix it.

@danny0405 danny0405 added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Mar 31, 2020

@danny0405 danny0405 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1, looks good from my side.

@danny0405 danny0405 closed this in 43261e4 Apr 15, 2020
@docete
docete deleted the CALCITE-3881 branch April 16, 2020 13:28
jamesstarr pushed a commit to jamesstarr/calcite that referenced this pull request Mar 16, 2026
…e corner case (Zhenghua Gao)

SqlFunctions#addMonths use DateTimeUtils#ymdToUnixDate to calculate the
JDN(julian day number). But in some corner cases it yields incorrent
results. The root cause is: the algorithm of DateTimeUtils#ymdToUnixDate
requires reasonable month(1 to 12)[1], but SqlFunctions#addMonths may
pass in a month out of the reasonable range. This PR will fix it.

close apache#1890
jamesstarr pushed a commit to jamesstarr/calcite that referenced this pull request Mar 16, 2026
apache#325)

…e corner case (Zhenghua Gao)

SqlFunctions#addMonths use DateTimeUtils#ymdToUnixDate to calculate the
JDN(julian day number). But in some corner cases it yields incorrent
results. The root cause is: the algorithm of DateTimeUtils#ymdToUnixDate
requires reasonable month(1 to 12)[1], but SqlFunctions#addMonths may
pass in a month out of the reasonable range. This PR will fix it.

close apache#1890
jamesstarr pushed a commit to jamesstarr/calcite that referenced this pull request Mar 16, 2026
…e corner case (Zhenghua Gao)

SqlFunctions#addMonths use DateTimeUtils#ymdToUnixDate to calculate the
JDN(julian day number). But in some corner cases it yields incorrent
results. The root cause is: the algorithm of DateTimeUtils#ymdToUnixDate
requires reasonable month(1 to 12)[1], but SqlFunctions#addMonths may
pass in a month out of the reasonable range. This PR will fix it.

close apache#1890
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants