-
Notifications
You must be signed in to change notification settings - Fork 25.2k
ESQL: Avoid regex extract attributes removal #127563
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
base: main
Are you sure you want to change the base?
ESQL: Avoid regex extract attributes removal #127563
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
buildkite test this |
I'm really confused. I can get a result of |
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.
@kanoshiou I really appreciate you provided this PR and you tried to understand where the fix needs to go.
Unfortunately, this is a trivial fix that doesn't quite catch the true reason for the initial failure.
The essence of the failure is the fact that lookup join
can override the type
user-provided field with its own type
field. The type
from eval
is of type integer
while the type
that comes from the lookup join
is of type keyword
. Because the list of field names didn't contain type
the Analyzer couldn't learn about that type
that exists in message_types_lookup
and the only thing it knew about its type is that it comes from eval
.
lookup join
(like enrich
and maybe inlinestats
) are special in the sense that they add some columns to the result, so some of the rules we have in EsqlSession.fieldNames
need to be adjusted to account for these special characteristics. Because lookup join
can add a field of the same name as type
coming from an eval
before the said lookup join command, we have a special check in fieldNames
that forbids the removal of those Alias
es.
Your proposed solution does this:
- places the input references of grok in a new variable, instead of the
referenceBuilder
that was used before - the special check above for lookup join is not applied to
referenceBuilder
forgrok
because the input reference is not there anymore - you add to
referenceBuilder
the content of the grok-special variable
This is a bypass of the lookup join
special removal check.
Instead, let the grok
references in referenceBuilder
where they are and don't let the special lookup join
check remove it. The issue is with the lookup join
check, not with grok
, so adjust that one. I have the feeling that check is applicable in other cases, only that we didn't catch those yet.
The inputs required by
Grok
orDissect
might be removed later, so we need to add them separately to thereferencesBuilder
afterward.Closes #127468