Skip to content

Conversation

@devanbenz
Copy link
Contributor

@devanbenz devanbenz commented Dec 1, 2025

Adds tests for date_part to ensure that we can support it using influxql


specs for date_part

date_part(part, expression)

Arguments

- part: Part of the date to return. The following date parts are supported:
   - year
    - quarter (emits value in inclusive range [1, 4] based on which quartile of the year the date is in)
    - month
    - week (week of the year)
    - day (day of the month)
    - hour
    - minute
    - second
    - millisecond
    - microsecond
    - nanosecond
    - dow (day of the week where Sunday is 0)
    - doy (day of the year)
    - epoch (seconds since Unix epoch)
    - isodow (day of the week where Monday is 0)
- expression: Time expression to operate on. Can be a constant, column, or function.

Example usage:

SELECT * FROM some_measurement
WHERE time >= now() - 10d AND time <= now() AND (date_part(time, dow) != 0 AND date_part(time, dow) != 6)

@devanbenz devanbenz marked this pull request as ready for review December 1, 2025 23:37
@devanbenz devanbenz self-assigned this Dec 1, 2025
Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

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

LGTM. Are you going to merge this before the rest of the work is done? Would it be better to merge this after the implementation is complete?

Please add a reviewer from the V3 InfluxQL team, as well.

@devanbenz
Copy link
Contributor Author

LGTM. Are you going to merge this before the rest of the work is done? Would it be better to merge this after the implementation is complete?

Please add a reviewer from the V3 InfluxQL team, as well.

Since I don't need to add any functionality outside of tests I will merge this and the influxdb changes at the same time.

Copy link

@mhilton mhilton left a comment

Choose a reason for hiding this comment

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

Are you planning to support the uppercase versions of the parts too? Eg 'YEAR' 'DOW'? If so do you want to have some tests for those too?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants