Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upProposal: scalar functions similar to vector #4558
Comments
Armatorix
changed the title
Propsal: scalar functions similar to vector
Proposal: scalar functions similar to vector
Aug 29, 2018
This comment has been minimized.
This comment has been minimized.
|
This was something I specifically avoided when considering PromQL changes, as overloading functions makes them harder to understand - particularly if the output type varies too as you seem to be proposing. Instead if you've a different type of input, you get a different function (e.g. avg_over_time vs avg). Once you do that any benefits are quite a bit smaller. |
This comment has been minimized.
This comment has been minimized.
|
You're probably right with overloading. |
This comment has been minimized.
This comment has been minimized.
|
That seems like it'd be a bit much clutter in the language for something that's already possible. The performance differences here are negligible, we're only talking doing math on a single value. |
Armatorix commentedAug 29, 2018
•
edited
Proposal
Now when you want to make some functions like
floor,round,ceil, etc. on scalar you've got to firstly change it to vector than make some functions on it and change it back to scalar. IMO it would be better to have also functions directly on scalars.Example:
scalar(round(vector(time())))round(time())Or I'm missing some feature or concept?