-
Notifications
You must be signed in to change notification settings - Fork 67
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
Reset stateful expressions on EOS #5069
Conversation
d015b27
to
de4b911
Compare
de4b911
to
d756794
Compare
This commit fixes a bug where stateful expressions used in ops were not getting reset when the op encountered EOS. This would most notably result in unexpected values when using stateful expressions inside of lateral queries. Closes #4943
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might need a stack
arena *zed.Arena // For zed.Values created during compilation. | ||
deletes *sync.Map | ||
funcs map[string]expr.Function | ||
resetters expr.Resetters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might need an expr.Resetters stack here to handle stateful expressions nested at different levels correctly but this looks good for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the one area for concern here is with over expressions. Everywhere else we just collect resetters for the expressions before recursing down into the flowgraph.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will revisit.
This commit fixes a bug where stateful expressions were not getting reset when an op encounters EOS. This would most notably result in unexpected values when using stateful expressions inside of lateral queries.
Closes #4943
Closes #4937