-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Expressions] Fix bug with expression reference extraction #107309
Conversation
Pinging @elastic/kibana-app-services (Team:AppServices) |
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.
code LGTM
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: |
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
There seems to be a mismatch in how extract and inject were expecting references to be prefixed.
Extract was increasing the "step" counter for every reference that gets extracted.
Inject was increasing the counter for every function it encounters.
So, an expression like
foo | ref refKey="a"
, extract would prefix the ref withl0
since it was the first ref that it sees.But extract would search through all the references for
l0
prefixes for thefoo
function andl1
for theref
function.This changes
extract
to match the way inject does it. Increase the prefix count for every function it encounters.Includes a test to make sure the extract is functioning as expected and that doing an extract and then immediately injecting it back provides the original expression.