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

feat(sql): add optional interval specifier (stride) for timestamp_floor function #3017

Merged
merged 10 commits into from
Mar 8, 2023

Conversation

eugenels
Copy link
Contributor

This PR enhances the 'kind' parameter by including an optional stride interval specifier, denoted as timestamp_floor('15m', ts). The stride interval must be greater than zero and works for units up to weeks. The implementation of this feature is based on the same logic used in the PostgreSQL function date_bin('15 minutes', ts, '1970-01-01 00:00:00.000000').

Fixes: #2946

@eugenels eugenels marked this pull request as ready for review February 24, 2023 17:44
@bziobrowski
Copy link
Contributor

@amyshwang timestamp_floor()'s description will need updating once this PR is merged .

Copy link
Contributor

@bziobrowski bziobrowski left a comment

Choose a reason for hiding this comment

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

👍

@ideoma
Copy link
Collaborator

ideoma commented Mar 8, 2023

[PR Coverage check]

😍 pass : 79 / 84 (94.05%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/engine/functions/date/TimestampFloorFunctionFactory.java 22 25 88.00%
🔵 io/questdb/griffin/engine/functions/date/TimestampFloorFunctions.java 30 32 93.75%
🔵 io/questdb/griffin/engine/functions/date/TimestampCeilFunctionFactory.java 2 2 100.00%
🔵 io/questdb/std/datetime/microtime/Timestamps.java 23 23 100.00%
🔵 io/questdb/griffin/engine/functions/date/DateTruncFunctionFactory.java 2 2 100.00%

@bluestreak01 bluestreak01 merged commit 5510042 into master Mar 8, 2023
@bluestreak01 bluestreak01 deleted the generic_ts_floor branch May 17, 2023 15:49
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.

Timestamp Floor Support for Intervals
4 participants