Skip to content

ATLAS-5014 : Basic Search : excludeHeaderAttributes is true, order of… - #720

Open
pareshddevalia wants to merge 1 commit into
apache:masterfrom
pareshddevalia:ATLAS-5014
Open

ATLAS-5014 : Basic Search : excludeHeaderAttributes is true, order of…#720
pareshddevalia wants to merge 1 commit into
apache:masterfrom
pareshddevalia:ATLAS-5014

Conversation

@pareshddevalia

Copy link
Copy Markdown
Contributor

… 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

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants