This is an automated email from the ASF dual-hosted git repository. sarath pushed a commit to branch branch-0.8 in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-0.8 by this push: new 2fdbc85 ATLAS-3036: Improve FullTextMapper performance during entity retrieval - #3 2fdbc85 is described below commit 2fdbc851db06f7ebe96cc3fde4d8507d088e7ec6 Author: Sarath Subramanian <ssubraman...@hortonworks.com> AuthorDate: Mon Jan 28 20:45:00 2019 -0800 ATLAS-3036: Improve FullTextMapper performance during entity retrieval - #3 --- .../store/graph/v1/EntityGraphRetriever.java | 47 ++++++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java index 5093714..200f56b 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/EntityGraphRetriever.java @@ -34,6 +34,7 @@ import org.apache.atlas.repository.graphdb.AtlasEdge; import org.apache.atlas.repository.graphdb.AtlasEdgeDirection; import org.apache.atlas.repository.graphdb.AtlasVertex; import org.apache.atlas.type.AtlasArrayType; +import org.apache.atlas.type.AtlasBuiltInTypes.AtlasObjectIdType; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasMapType; import org.apache.atlas.type.AtlasStructType; @@ -489,19 +490,49 @@ public final class EntityGraphRetriever { ret = null; } break; - case ARRAY: - if(attribute.getAttributeDef().isSoftReferenced()) { - ret = mapVertexToArrayForSoftRef(entityVertex, attribute, entityExtInfo, isMinExtInfo); + case ARRAY: { + final boolean skipAttribute; + + if (!includeReferences) { + AtlasType elementType = ((AtlasArrayType) attrType).getElementType(); + + skipAttribute = (elementType instanceof AtlasObjectIdType || elementType instanceof AtlasEntityType); + } else { + skipAttribute = false; + } + + if (skipAttribute) { + ret = null; } else { - ret = mapVertexToArray(entityVertex, (AtlasArrayType) attrType, qualifiedName, entityExtInfo, isOwnedAttribute, isMinExtInfo, includeReferences); + if (attribute.getAttributeDef().isSoftReferenced()) { + ret = mapVertexToArrayForSoftRef(entityVertex, attribute, entityExtInfo, isMinExtInfo); + } else { + ret = mapVertexToArray(entityVertex, (AtlasArrayType) attrType, qualifiedName, entityExtInfo, isOwnedAttribute, isMinExtInfo, includeReferences); + } } + } break; - case MAP: - if(attribute.getAttributeDef().isSoftReferenced()) { - ret = mapVertexToMapForSoftRef(entityVertex, attribute, entityExtInfo, isMinExtInfo); + case MAP: { + final boolean skipAttribute; + + if (!includeReferences) { + AtlasType valueType = ((AtlasMapType) attrType).getValueType(); + + skipAttribute = (valueType instanceof AtlasObjectIdType || valueType instanceof AtlasEntityType); + } else { + skipAttribute = false; + } + + if (skipAttribute) { + ret = null; } else { - ret = mapVertexToMap(entityVertex, (AtlasMapType) attrType, qualifiedName, entityExtInfo, isOwnedAttribute, isMinExtInfo, includeReferences); + if (attribute.getAttributeDef().isSoftReferenced()) { + ret = mapVertexToMapForSoftRef(entityVertex, attribute, entityExtInfo, isMinExtInfo); + } else { + ret = mapVertexToMap(entityVertex, (AtlasMapType) attrType, qualifiedName, entityExtInfo, isOwnedAttribute, isMinExtInfo, includeReferences); + } } + } break; case CLASSIFICATION: // do nothing