-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Add assertion that all field mapper names are interned #87238
Add assertion that all field mapper names are interned #87238
Conversation
Follow up to elastic#86301. Assert that all field names are interned so we don't lose this optimization and fix `FieldAliasMapper.name` for it not to trip.
Pinging @elastic/es-search (Team:Search) |
assert mapper.simpleName() == mapper.simpleName().intern(); | ||
if (mapper instanceof ObjectMapper) { | ||
((ObjectMapper) mapper).mappers.forEach(MappingLookup::assertNamesInterned); | ||
} |
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.
thanks a lot for working on this. Maybe silly question, but could this be instead a new test method added to MapperTestCase instead of an assertion?
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 figured that a test will always only cover a portion of our parsing (and wouldn't have caught the alias field case fixed here for example) while an assertion gives us full coverage?
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.
@romseygeek do you have opinions here? Do you mind giving this a quick look?
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 an assertion is fine, all of the MapperTestCase tests will build a MappingLookup so this assertion will trip there as well.
assert mapper.simpleName() == mapper.simpleName().intern(); | ||
if (mapper instanceof ObjectMapper) { | ||
((ObjectMapper) mapper).mappers.forEach(MappingLookup::assertNamesInterned); | ||
} |
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.
thanks a lot for working on this. Maybe silly question, but could this be instead a new test method added to MapperTestCase instead of an assertion?
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.
Thanks for your patience @original-brownbear
Thanks Luca! |
Follow up to #86301. Assert that all field names are interned so we don't
lose this optimization and fix
FieldAliasMapper.name
for it not to trip.