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

Add non ICU time_bucket function #5835

Merged
merged 36 commits into from
Jan 7, 2023

Conversation

papparapa
Copy link
Contributor

#5589

Split from PR #5665.

While ICU time_bucket implementation in #5665 still has some problems, non-ICU time_bucket seems ready.
This PR adds only non-ICU time_bucket functions.

They behave almost same as TimescaleDB's time_bucket.

TIME_BUCKET(bucket_width: INTERVAL, ts: TIMESTAMP)
TIME_BUCKET(bucket_width: INTERVAL, ts: DATE)

TIME_BUCKET(bucket_width: INTERVAL, ts: TIMESTAMP, offset: INTERVAL)
TIME_BUCKET(bucket_width: INTERVAL, ts: DATE, offset: INTERVAL)

TIME_BUCKET(bucket_width: INTERVAL, ts: TIMESTAMP, origin: TIMESTAMP)
TIME_BUCKET(bucket_width: INTERVAL, ts: DATE, origin: DATE)

@hawkfish hawkfish self-requested a review January 6, 2023 20:54
Copy link
Contributor

@hawkfish hawkfish left a comment

Choose a reason for hiding this comment

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

Looks pretty good - just use the library functions that check overflow.

src/function/scalar/date/time_bucket.cpp Outdated Show resolved Hide resolved
src/function/scalar/date/time_bucket.cpp Outdated Show resolved Hide resolved
src/function/scalar/date/time_bucket.cpp Outdated Show resolved Hide resolved
@Mytherin Mytherin merged commit 6be5ebf into duckdb:master Jan 7, 2023
@Mytherin
Copy link
Collaborator

Mytherin commented Jan 7, 2023

Thanks!

@papparapa papparapa deleted the add-non-icu-time-bucket-function branch January 8, 2023 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants