The position range of nested aggregate expression was wrong, for the expression "(sum(foo))" the position of "sum(foo)" should be 1-9, but the parser could not decide the end of the expression on pos 9, instead it read ahead to pos 10 and then emitted the aggregate. But we only kept the last closing position (10) and wrote that into the aggregate. The reason for this is that the parser cannot know from "(sum(foo)" alone if the aggregate is finished. It could be finished as in "(sum(foo))" but equally it could continue with group modifier as "(sum(foo) by (bar))". The fix is to track ")" tokens in a stack in addition to the lastClosing position, which is overloaded with other things like offset number tracking. Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>pull/16041/head
parent
ba690a8c4c
commit
06d0b063ea
Loading…
Reference in new issue