ATLAS-5159:- Export APIs: Exporting parent type doesn't export child type #511
+151
−31
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.
ATLAS-5159
What changes were proposed in this pull request?
Background:
Exporting entities of a parent type (e.g., Referenceable) does not export entities of its child type (e.g., hive_table).
When attempting to export using the parent type with unique attributes, no child entities were returned, leading to incomplete exports.
Root Cause:
The previous implementation of StartEntityFetchByExportRequest did not consistently account for the type hierarchy. Specifically, when fetching by uniqueAttributes/matchType, the logic did not automatically include subtypes, meaning only entities explicitly labeled with the parent type were discovered.
Changes Proposed:
Hierarchical Type Lookup: Updated getEntitiesForMatchTypeUsingUniqueAttributes to identify the AtlasEntityType and automatically include all its subtypes (entityType.getAllSubTypes()) in the search criteria.
Gremlin Binding Expansion: Refactored getBindingsForTypeName to handle comma-separated type names and recursively resolve all subtypes for each provided type. This ensures that a query for a parent type translates into a Gremlin search across the entire inheritance tree.
Enhanced Match Logic:
Improved getEntitiesForMatchTypeType to utilize the expanded type list.
Impact:
Exporting parent types like Referenceable now correctly includes all child entities.
Maintains consistent behavior for all fetch types (FULL, INCREMENTAL, CONNECTED).
Minimal impact on performance; no additional schema changes are required.
How was this patch tested?
Maven Build:- Build Successfull.
Manual testing of export requests with all three fetch types: FULL, INCREMENTAL, CONNECTED.
Verified entity GUIDs are correctly returned for parent types and child entities,Concrete types with unique attributes (hive_table)
Confirmed behavior for concrete types, abstract types, and invalid/misspelled types.
Logs verified query execution, fetch type handling, and error reporting.