influxdata / influxdata/influxdb

v.timeRangeStart isn't a consistent type

Open
#20,810 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

team/query
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Steps to reproduce:
This is a comment from a user in the Flux slack. It is point number 4 in https://github.com/influxdata/flux/issues/3507.

In summary, the v.timeRangeStart variable isn't a consistent type which makes it more convoluted to perform duration math on it. Sometimes it is a time and sometimes it is a duration for a relative time. We should consider just choosing one type and going with that. Because it is not a consistent type, it makes processing that time a bit more difficult. While range() can accept both times and durations, other methods cannot necessarily do that so either time(v:) or duration(v:) are needed.

I believe the Flux language is working on making it so more of the time functions will accept either and behave the same, but I think it's still useful to discuss the possibility of setting this specific variable to a single type.

Expected behavior:
When creating a flux script, the v.timeRangeStart variable should be a consistent type.

Actual behavior:
It is either a time or duration type depending on the input.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced Flux issue #3507 and inspect how v.timeRangeStart is produced for absolute and relative ranges, including how range() handles each type. A complete change would choose and document one consistent type for v.timeRangeStart and verify that duration and time operations behave accordingly.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.