grafana / lezer-logql

LogQL lezer grammar
Apache License 2.0
3 stars 4 forks source link

Nested BinOpExpr returns the incorrect query. #47

Open gwdawson opened 1 year ago

gwdawson commented 1 year ago

when using more than one BinOpExpr, the returned query is incorrect. looking at the example, you can see that the first expr is duplicated and the third one is lost.

QUERY:
rate({one=""}[1m]) + rate({two=""}[5m]) + rate({three=""}[10m])

EXPECTED:
rate(
  {one=""}
  [1m]
)
+
rate(
  {two=""}
  [5m]
)
+
rate(
  {three=""}
  [10m]
)

ACTUAL:
rate(
  {one=""}
  [1m]
)
+
rate(
  {two=""}
  [5m]
)
+
rate(
  {one=""}
  [1m]
)