influxdata / influxdata/influxql
`date_part` for timestamp extraction
- Dominant language
- Go
- Stars
- 170
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
Apache Datafusion, the query engine that powers Influx v3, supports the following function: https://datafusion.apache.org/user-guide/sql/scalar_functions.html#date-part
Please implement `date_part` within influxql.
`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)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.