----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/73549/#review223415 -----------------------------------------------------------
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java Line 487 (original), 470 (patched) <https://reviews.apache.org/r/73549/#comment312478> Should we consider removing the unused functions like - findBySuperTypeAndUniquePropertyName(AtlasGraph graph, String typeName, String propertyName, Object attrVal) And also some private function are not used as we removed the code as part of this patch like: getAtlasVertexFromIndexQuery canUseIndexQuery Please check and remove if necessary. repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java Lines 509 (patched) <https://reviews.apache.org/r/73549/#comment312479> Should we consider to merge the findByTypeAndUniquePropertyName and findBySuperTypeAndUniquePropertyName something like : public static AtlasVertex findByTypeAndPropertyName(AtlasGraph graph, String typeName, boolean isSuperType, Map<String, Object> attributeValues) { MetricRecorder metric = RequestContext.get().startMetricRecord(isSuperType ? "findBySuperTypeAndPropertyName" : "findByTypeAndPropertyName"); AtlasGraphQuery query = graph.query(); if (isSuperType) { query.has(Constants.SUPER_TYPES_PROPERTY_KEY, typeName); } else { query.has(ENTITY_TYPE_PROPERTY_KEY, typeName); } query.has(STATE_PROPERTY_KEY, AtlasEntity.Status.ACTIVE.name()); for (Map.Entry<String, Object> entry : attributeValues.entrySet()) { String attrName = entry.getKey(); Object attrValue = entry.getValue(); if (attrName != null && attrValue != null) { query.has(attrName, attrValue); } } Iterator<AtlasVertex> results = query.vertices().iterator(); AtlasVertex vertex = results.hasNext() ? results.next() : null; RequestContext.get().endMetricRecord(metric); return vertex; } - Sidharth Mishra On Aug. 26, 2021, 8:32 p.m., Sarath Subramanian wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/73549/ > ----------------------------------------------------------- > > (Updated Aug. 26, 2021, 8:32 p.m.) > > > Review request for atlas, Ashutosh Mestry, Disha Talreja, Jayendra Parab, > Madhan Neethiraj, Nikhil Bonte, Nixon Rodrigues, Radhika Kundam, and Sidharth > Mishra. > > > Bugs: ATLAS-4403 > https://issues.apache.org/jira/browse/ATLAS-4403 > > > Repository: atlas > > > Description > ------- > > When a entity type has multiple unique attributes defined: > > unique_attr1 > unique_attr2 > During creation of entity, we check if entity with unique attributes is > already present and return/update them. The current logic check if entity is > present - one unique attribute at a time, if present will return immediately. > > We should improve the lookup logic to look for entity with all unique > attributes specified and not just return on the first unique attribute value. > > > Diffs > ----- > > > repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasGraphUtilsV2.java > e73f084b8 > > > Diff: https://reviews.apache.org/r/73549/diff/4/ > > > Testing > ------- > > Pre-commit: > https://ci-builds.apache.org/job/Atlas/job/PreCommit-ATLAS-Build-Test/822/consoleFull > (SUCCESS) > > > Thanks, > > Sarath Subramanian > >
