Skip to content

Commit

Permalink
Merge pull request #3184 from atlanhq/PLT-1638-dynamictable-fix
Browse files Browse the repository at this point in the history
feat: add a way to avoid checks for supertype for tables
  • Loading branch information
sumandas0 authored Jun 4, 2024
2 parents 2e84ff7 + c004d35 commit d59dc31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class AtlasTypeRegistry {
private static final Logger LOG = LoggerFactory.getLogger(AtlasTypeRegistry.class);
private static final int DEFAULT_LOCK_MAX_WAIT_TIME_IN_SECONDS = 15;

public static final ArrayList<String> TYPENAMES_TO_SKIP_SUPER_TYPE_CHECK = new ArrayList<String>() {{
add("Table");
}};
protected RegistryData registryData;
private final TypeRegistryUpdateSynchronizer updateSynchronizer;
private final Set<String> missingRelationshipDefs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
import org.apache.atlas.type.AtlasEntityType;
import org.apache.atlas.type.AtlasEnumType;
import org.apache.atlas.type.AtlasStructType;
import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
import org.apache.atlas.type.AtlasTypeRegistry;
import org.apache.atlas.type.AtlasType;
import org.apache.atlas.type.AtlasStructType.AtlasAttribute;
import org.apache.atlas.util.FileUtils;
import org.apache.atlas.utils.AtlasPerfMetrics;
import org.apache.atlas.utils.AtlasPerfMetrics.MetricRecorder;
Expand Down Expand Up @@ -349,14 +350,16 @@ public static AtlasVertex findByUniqueAttributes(AtlasGraph graph, AtlasEntityTy
vertex = findByTypeAndUniquePropertyName(graph, typeName, uniqAttrValues);

// if no instance of given typeName is found, try to find an instance of type's sub-type
if (vertex == null && !entitySubTypes.isEmpty()) {
// Added exception for few types to solve https://atlanhq.atlassian.net/browse/PLT-1638
if (vertex == null && !entitySubTypes.isEmpty() && !AtlasTypeRegistry.TYPENAMES_TO_SKIP_SUPER_TYPE_CHECK.contains(typeName)) {
vertex = findBySuperTypeAndUniquePropertyName(graph, typeName, uniqAttrValues);
}
} else {
vertex = findByTypeAndPropertyName(graph, typeName, attrNameValues);

// if no instance of given typeName is found, try to find an instance of type's sub-type
if (vertex == null && !entitySubTypes.isEmpty()) {
// Added exception for few types to solve https://atlanhq.atlassian.net/browse/PLT-1638
if (vertex == null && !entitySubTypes.isEmpty() && !AtlasTypeRegistry.TYPENAMES_TO_SKIP_SUPER_TYPE_CHECK.contains(typeName)) {
vertex = findBySuperTypeAndPropertyName(graph, typeName, attrNameValues);
}
}
Expand Down

0 comments on commit d59dc31

Please sign in to comment.