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

[Date] [Datetime] [Timestamp] Handle QUARTER, WEEK(DAY), ISOWEEK #204

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

ohaibbq
Copy link
Contributor

@ohaibbq ohaibbq commented Apr 3, 2024

A number of bugfixes here!

  • Full range of dates 0001-01-01 - 9999-12-31 now supported. Previously dateValueFromLiteral hit int64 caps due to the time.Hour multiplication occurring before we divided it by time.Second.
  • QUARTER support for DATE_ADD
  • WEEK, WEEK(DAY OF WEEK) support for DATE_DIFF, DATE_TRUNC
  • ISOWEEK, ISOYEAR, QUARTER support for DATE_TRUNC

Most date function logic has been de-duplicated and now DATETIME and TIMESTAMP functions defer to DATE methods for date parts at the day level or higher.

Closes #202
Closes #194
Closes #193

@codecov-commenter
Copy link

Codecov Report

Merging #204 (1c7cacc) into main (a68af1a) will increase coverage by 0.50%.
The diff coverage is 73.91%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #204      +/-   ##
==========================================
+ Coverage   47.88%   48.38%   +0.50%     
==========================================
  Files          47       47              
  Lines       17916    17839      -77     
==========================================
+ Hits         8579     8632      +53     
+ Misses       7901     7764     -137     
- Partials     1436     1443       +7     

fullWeeks := days / 7
remainder := days % 7

counts := make([]int64, 7)
Copy link
Owner

Choose a reason for hiding this comment

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

nits: How about using array ? dayOfWeek := [7]int64{}

@goccy
Copy link
Owner

goccy commented Apr 6, 2024

Thank you for your contribution ! Please fix lint error 🙏

@goccy
Copy link
Owner

goccy commented Apr 8, 2024

LGTM 👍

@goccy goccy merged commit b6dd6a5 into goccy:main Apr 8, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants