ATLAS-5014 : Basic Search : excludeHeaderAttributes is true, order of… - #720
Open
pareshddevalia wants to merge 1 commit into
Open
ATLAS-5014 : Basic Search : excludeHeaderAttributes is true, order of…#720pareshddevalia wants to merge 1 commit into
pareshddevalia wants to merge 1 commit into
Conversation
… attribute in the response changes Store search attributes in LinkedHashSet so json array order is kept when building attributes.name and attributes.values. Duplicate attribute names are deduped using first-occurrence order. Fixes mismatched column order between request and response for POST /api/atlas/v2/search/basic.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
… attribute in the response changes
Store search attributes in LinkedHashSet so json array order is kept when building attributes.name and attributes.values. Duplicate attribute names are deduped using first-occurrence order. Fixes mismatched column order between request and response for POST /api/atlas/v2/search/basic.
What changes were proposed in this pull request?
Basic search with excludeHeaderAttributes=true did not preserve the order of attributes from the client request. For example, a request with "attributes": ["qualifiedName", "createTime"] could return "attributes": { "name": ["createTime", "qualifiedName"], ... }, so column order in attributes.values did not match the request.
Root cause: SearchParameters.attributes was stored as Set. Jackson deserialized the JSON array into a HashSet, which does not preserve insertion order. The response builder copied that set into attributes.name and used the same iteration order when building each row in attributes.values.
Fix:
Store attributes in a LinkedHashSet in SearchParameters and QuickSearchParameters
Use @JsonDeserialize(as = LinkedHashSet.class) so JSON deserialization keeps order
Update relationship search REST API to accept List query params, which are normalized through the same setter
How was this patch tested?
Unit tests
Manual testing
Started Atlas with PostgreSQL + Hive using docker compose
Created hive_table entities via Hive