Add Mathematical Operators and Ad Hoc Fields to GLQL
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Context On Issue:
GLQL currently (2025-01-6) does not support mathematical operations or ad hoc fields. As we think about custom fields (noted in this thread) we may be able to converge some of this work.
Himanshu stated the following regarding this proposed feature addition:
I last talked about it in &14939 (comment 2090750236). Technically yes it is possible, its just a matter of when we want to prioritize it. We can carry over that discussion into a follow up issue.
TL;DR is: we need a parser for calculated fields, we can have the same parser be reused for both GLQL and custom fields so that syntax is the same.
There are two ways to define them:
fields: title, assignee, div(mult(reach, impact, confidence), effort) AS "RICE score"^ is easier to implement but harder to read.
fields: title, assignee, reach * impact * confidence / effort as "RICE score"^ is easier to read but harder to implement.
The biggest question is how we can use calculated fields to be used in a query like:
startDate.value - today() > 5. I'm afraid it isn't possible until GLQL is moved to the backend as a service. We can't really send a calculation to GraphQL, we'll have to send the whole query to the backend and let it figure out the calculation.
Additional Use cases
As noted from an Ultimate customer: "I would love to be able to use GQL to summarize the number of epics or issues I have matching a set of scoped labels."
From Himanshu:
What we're really looking for is group_by, combined with mathematical operations. So you could do something like group_by: labels("workflow::*") and fields: count, sum(weight) together.
