generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 181
Error handling for dot-containing field names #4907
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
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
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
90 changes: 90 additions & 0 deletions
90
integ-test/src/yamlRestTest/resources/rest-api-spec/test/issues/4896.yml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # Issue: https://github.com/opensearch-project/sql/issues/4896 | ||
| # ArrayIndexOutOfBoundsException when querying index with dot-only field name in disabled object | ||
| # | ||
| # Root cause: When a document has a field name that is just "." (a single dot), | ||
| # the JsonPath constructor's split("\\.") returns an empty array, causing | ||
| # paths.get(0) to crash with ArrayIndexOutOfBoundsException. | ||
| # | ||
| # This can happen when an index has a disabled object field (enabled: false), | ||
| # which allows storing documents without validating inner field names. | ||
| # | ||
| # Fix: The query engine now tolerates corrupt/invalid field names by returning null | ||
| # for those fields (with a warning log), allowing the rest of the document to be | ||
| # processed normally. | ||
|
|
||
| setup: | ||
| - do: | ||
| query.settings: | ||
| body: | ||
| transient: | ||
| plugins.calcite.enabled: true | ||
| # Create index with disabled object field | ||
| - do: | ||
| indices.create: | ||
| index: test_disabled_object_4896 | ||
| body: | ||
| mappings: | ||
| properties: | ||
| log: | ||
| type: object | ||
| enabled: false | ||
| "@timestamp": | ||
| type: date | ||
| message: | ||
| type: text | ||
|
|
||
| # Index document with "." field name inside disabled object | ||
| # OpenSearch allows this because the object is disabled (no validation of inner fields) | ||
| - do: | ||
| index: | ||
| index: test_disabled_object_4896 | ||
| id: 1 | ||
| refresh: true | ||
| body: | ||
| "@timestamp": "2025-11-26T17:10:00.000Z" | ||
| message: "test message" | ||
| log: | ||
| ".": "problematic value" | ||
|
|
||
| --- | ||
| teardown: | ||
| - do: | ||
| query.settings: | ||
| body: | ||
| transient: | ||
| plugins.calcite.enabled: false | ||
| - do: | ||
| indices.delete: | ||
| index: test_disabled_object_4896 | ||
|
|
||
| --- | ||
| "Query index with dot-only field name in disabled object should succeed with valid fields": | ||
| - skip: | ||
| features: | ||
| - headers | ||
| # Before the fix: ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 | ||
| # After the fix: Query succeeds, invalid field returns null with a warning log, | ||
| # and valid fields (@timestamp, message) are returned normally | ||
| # Query valid fields - should succeed | ||
| - do: | ||
| headers: | ||
| Content-Type: 'application/json' | ||
| ppl: | ||
| body: | ||
| query: source=test_disabled_object_4896 | fields @timestamp, message | ||
| - match: { "total": 1 } | ||
| - match: { "datarows.0.0": "2025-11-26 17:10:00" } | ||
| - match: { "datarows.0.1": "test message" } | ||
|
|
||
| # Query the log field specifically - should succeed without crash | ||
| # The log field with invalid "." field name will have null for that invalid subfield | ||
| - do: | ||
| headers: | ||
| Content-Type: 'application/json' | ||
| ppl: | ||
| body: | ||
| query: source=test_disabled_object_4896 | fields log | ||
| - match: { "total": 1 } | ||
| # The log field returns an empty object because the invalid "." field resolves to null | ||
| # and null values are omitted from JSON serialization | ||
| - match: { "datarows.0.0": {} } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.