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

Fix timestamp_add_interval_months to pass any date #6815

Merged
merged 2 commits into from
Jul 1, 2023

Conversation

jayzhan211
Copy link
Contributor

Which issue does this PR close?

Closes #6814.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
@github-actions github-actions bot added the core Core DataFusion crate label Jul 1, 2023
Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
@@ -579,8 +579,8 @@ async fn timestamp_add_interval_months() -> Result<()> {
let t1_naive = chrono::NaiveDateTime::parse_from_str(res1, format).unwrap();
let t2_naive = chrono::NaiveDateTime::parse_from_str(res2, format).unwrap();

let year = t1_naive.year() + (t1_naive.month() as i32 + 17) / 12;
let month = (t1_naive.month() + 17) % 12;
let year = t1_naive.year() + (t1_naive.month0() as i32 + 17) / 12;
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using NOW() we could use some table of dates instead to test it?.

Copy link
Contributor

Choose a reason for hiding this comment

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

This would avoid the test breaking suddenly on a certain date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Dandandan It seems your suggestion is great, it failed today again :(

Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

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

Approve to get the main branch passing. Left a comment to improve the test

@Dandandan Dandandan merged commit d526a2e into apache:main Jul 1, 2023
2010YOUY01 pushed a commit to 2010YOUY01/arrow-datafusion that referenced this pull request Jul 5, 2023
* fix

Signed-off-by: jayzhan211 <jayzhan211@gmail.com>

* use month0

Signed-off-by: jayzhan211 <jayzhan211@gmail.com>

---------

Signed-off-by: jayzhan211 <jayzhan211@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix timestamp_add_interval_months to pass on any date
2 participants