Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PromQL: Evaluation changes structure of the AST #6627

Open
slrtbtfs opened this issue Jan 14, 2020 · 4 comments
Open

PromQL: Evaluation changes structure of the AST #6627

slrtbtfs opened this issue Jan 14, 2020 · 4 comments

Comments

@slrtbtfs
Copy link
Contributor

As discussed here #6612 (comment) the PromQL engine currently modifies the structure of the AST being evaluated.

These AST mutations could be prevented with reasonable effort.

Is this something that should be fixed?

@brian-brazil @juliusv

@brian-brazil
Copy link
Contributor

The structure of the AST shouldn't be changing. I know we also mutate some stuff in passing that is not the structure.

@juliusv
Copy link
Member

juliusv commented Jan 14, 2020

@brian-brazil Doesn't this mutate the structure?

prometheus/promql/engine.go

Lines 1062 to 1063 in 0c8e9ef

// Replacing SubqueryExpr with MatrixSelector.
e.Args[i] = ev.evalSubquery(subq)

@brian-brazil
Copy link
Contributor

Yeah, that's changing the structure.

@bboreham
Copy link
Member

bboreham commented Apr 2, 2024

Discussed at bug-scrub: general agreement that the AST should not be modified during the evaluation phase.
Perhaps an explicit "optimize" function would want to modify the AST, but that should happen prior to evaluation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants