-
Notifications
You must be signed in to change notification settings - Fork 26k
Fix NPE when querying pattern_text field in segment with no field values #142767
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
Merged
parkertimmins
merged 22 commits into
elastic:main
from
parkertimmins:parker/pattern-text-empty-segment-npe
Feb 25, 2026
Merged
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7e43341
Add tests which NPE segment has no pattern_text values
parkertimmins 23fddb3
Return empty doc values if segment has not pattern_text values
parkertimmins 068997c
Add tests for pattern_text with disabled templating
parkertimmins 013aae6
Fix pattern_text value loading with disabled templating
parkertimmins e1cbc1b
Use numbers in test values so will produce pattern_text arg tokens
parkertimmins 3a0d24b
add removed comment
parkertimmins 6f565d8
Fix pattern_text source-confirmed queries returning BytesRef
parkertimmins 4e34637
Merge branch 'main' into parker/pattern-text-empty-segment-npe
parkertimmins 8a70bdf
Add intervals query test for disabled templating
parkertimmins 9aace57
move from method to PatternTextDocValues
parkertimmins 1298c2e
Centralize doc values loading in PatternTextFallbackDocValues
parkertimmins 90c5199
add back some comments
parkertimmins d31fb5a
[CI] Auto commit changes from spotless
9019b19
Fix Source-confirmed queries bug in separate PR
parkertimmins 90af739
[CI] Auto commit changes from spotless
32471d9
Merge branch 'main' into parker/pattern-text-empty-segment-npe
parkertimmins 4198a0d
Revert "Fix Source-confirmed queries bug in separate PR"
parkertimmins ffe707a
missing import
parkertimmins 2c25ef9
Add comment
parkertimmins 63a9e9b
Update docs/changelog/142767.yaml
parkertimmins 68f599b
Merge branch 'main' into parker/pattern-text-empty-segment-npe
parkertimmins f3de3c6
Fix flaky multi-segment PatternText tests
parkertimmins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This feels kind of wrong to do - converting stored fields into doc values. Are you doing this to return
BinaryDocValuesfromloadDocValues()? Can we usePatternTextFallbackDocValuesinstead?Uh oh!
There was an error while loading. Please reload this page.
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.
Wrapping in doc values is just to simplify the valueFetcher logic. So PatternTextFallbackDocValues wraps the proper pattern_text, the binary fallback, and the stored fallback in a single binary doc values.
loadDocValuesdoes the same thing, but it makes the decision between the three options at the whole column level rather than on a per-doc basis. So it will have fewer branches since it doesn't require checking the main pattern_text iterator before falling back on each doc.I think we'll want to wrap the stored field in a doc value iterator, but we might be able to push this down into PatternTextFallbackDocValues in a cleaner way. I'll give it some more thought next week.
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.
If possible I think we should make this decision at the column level. And I think this is possible.