Fix flat_object to support subfield access in Painless scripts (Resolves #7138) - #22637
Fix flat_object to support subfield access in Painless scripts (Resolves #7138)#22637Aadityasharma1-programmer wants to merge 3 commits into
Conversation
opensearch-project#7138) Signed-off-by: Aaditya sharma <aadityasharmadec1@gmail.com>
PR Reviewer Guide 🔍(Review updated until commit c7eb9e7)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to c7eb9e7 Explore these optional code suggestions:
Previous suggestionsSuggestions up to commit 6265b68
Suggestions up to commit f79b049
|
|
❌ Gradle check result for f79b049: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit 6265b68 |
|
❌ Gradle check result for 6265b68: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Persistent review updated to latest commit c7eb9e7 |
|
❌ Gradle check result for c7eb9e7: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Description
This PR enables Painless Scripts to accurately fetch and evaluate doc values for
flat_objectsubfields.Previously, if a script attempted to read a subfield via
doc['flat_object_field.subfield'].value, it would receive the unparsed internal format containing the path prefix (e.g.,subfield=value). This broke script evaluations because thefielddataBuilderwas returning the raw_valueAndPathdata stream.How it was solved:
FlatObjectFieldType.fielddataBuilder()to dynamically wrapIndexFieldDataif the requested field is a subfield.PrefixFilteredSortedBinaryDocValueswhich wraps the standardSortedBinaryDocValues. During iteration within the script context, it filters the_valueAndPathstream for the exact subfield prefix (e.g.,subfield=) and strips the prefix before yielding the value.testSubfieldDocValue()inFlatObjectFieldDataTests.javato explicitly test script interactions withflat_objectsubfields and guarantee accurate filtering.Related Issues
Resolves #7138
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.