[BugFix] Fix rename with wildcard applying on hidden fields (#5099)#5350
Conversation
…pensearch-project#5099) Signed-off-by: Songkan Tang <songkant@amazon.com>
Decision LogRoot Cause: Approach: Added a post-filter in Alternatives Rejected:
Pitfalls: None encountered. The fix is minimal and only touches the wildcard rename path. Things to Watch: If new metadata fields are added to |
PR Reviewer Guide 🔍(Review updated until commit b8297ce)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to b8297ce
Previous suggestionsSuggestions up to commit 236b068
|
Update testCrossClusterRenameFullWildcard to expect only 3 user fields instead of 9 (including 6 metadata fields), aligning the test with the corrected behavior from PR opensearch-project#5350 where rename * no longer renames hidden/metadata fields. Signed-off-by: Songkan Tang <songkant@amazon.com>
|
Persistent review updated to latest commit b8297ce |
Description
When using
rename * as old_*(or any wildcard rename without a precedingfieldscommand), metadata/hidden fields like_id,_index,_score,_maxscore,_sort, and_routingwere incorrectly being matched and renamed. This happened becauseWildcardRenameUtils.matchFieldNamesmatched all fields in the schema including metadata fields.Root cause:
CalciteRelNodeVisitor.visitRename()passed all field names (including metadata fields) to the wildcard matching utility without filtering.Fix: After wildcard matching, filter out metadata fields using the existing
isMetadataField()check. This ensures wildcard renames only apply to user-visible fields, consistent with howfieldsand other commands handle metadata fields.Related Issues
Resolves #5099
Check List
-s)spotlessCheckpassed