atlas-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madhan Neethiraj <mad...@apache.org>
Subject Re: Review Request 72459: EntitySearchProcessor is failing on graph query with sortBy attribute.
Date Wed, 06 May 2020 22:59:40 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72459/#review220665
-----------------------------------------------------------




graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/tinkerpop/query/TinkerpopGraphQuery.java
Line 215 (original), 215 (patched)
<https://reviews.apache.org/r/72459/#comment309230>

    Why is it necessary to switch to LinkedHashSet here?



repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
Line 203 (original), 204 (patched)
<https://reviews.apache.org/r/72459/#comment309229>

    Instead of <typeName>.<attrName>, I suggest the following:
    
      AtlasAttribute sortByAttribute = context.getEntityType().getAttribute(sortBy);
      
      if (sortByAttribute != null) {
        AtlasGraphQuery.SortOrder qrySortOrder = sortOrder == SortOrder.ASCENDING ? ASC :
DESC;
        
        graphQuery.orderBy(sortByAttribute.getVertexPropertyName(), qrySortOrder)
      }
    
    This will ensure that sortBy will work for system-attributes as well - like __timestamp,
__modificationTimestamp.



repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
Lines 367 (patched)
<https://reviews.apache.org/r/72459/#comment309231>

    I suggest to replace use of guava library class with JDK equivalent: 
      StreamSupport.stream(graphQuery.vertexIds().iterator(), false).count()


- Madhan Neethiraj


On May 5, 2020, 10:11 p.m., Damian Warszawski wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72459/
> -----------------------------------------------------------
> 
> (Updated May 5, 2020, 10:11 p.m.)
> 
> 
> Review request for atlas, Bolke de Bruin, Madhan Neethiraj, and Nixon Rodrigues.
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> EntitySearchProcessor fails when doing search by classification and specify orderBy attribute.
The issue is that for graph query you cannot refer to attribute by name but need to provide
absolute path to entity attribute e.g. 
> 
>  
> 
> ```
> 
> { "attributes": [ "description", "comment", "popularityScore" ], "classification": "customer_NON_PII",
"excludeDeletedEntities": "False", "limit": "", "offset": 100, "sortBy": "Table.popularityScore",
"sortOrder": "DESCENDING", "typeName": "hive_table" }
> ```
> 
> this query fails with following exception:
> 
>  
> 
> ```
> 
> {"exception":{"message":"Provided key does not exist: hive_table.popularityScore","class":"java.lang.IllegalArgumentException","stacktrace":"java.lang.IllegalArgumentException:
Provided key does not exist: hive_table.popularityScore\n\tat com.google.common.base.Preconditions.checkArgument(Preconditions.java:163)\n\tat
org.janusgraph.graphdb.query.graph.GraphCentricQueryBuilder.
> orderBy(GraphCentricQueryBuilder.java:160)
> 
> ```
> 
>  
> 
> When specify full reference to attribute e.g. 
> 
>  
> 
> ```
> 
> { "attributes": [ "description", "comment", "popularityScore" ], "classification": "customer_NON_PII",
"excludeDeletedEntities": "False", "limit": "", "offset": 100, "sortBy": "Table.popularityScore",
"sortOrder": "DESCENDING", "typeName": "hive_table" }
> ```
> 
> it fails on validation stage
> 
>  
> 
> ```
> 
> {"exception":{"message":"Attribute Table.popularityScore not found for type Table","class":"org.apache.atlas.exception.AtlasBaseException","stacktrace":"org.apache.atlas.exception.AtlasBaseException:
Attribute Table.popularityScore not found for type Table\n\tat org.apache.atlas.discovery.SearchContext.validateAttributes(SearchContext.java:288)
> 
> ```
> 
> Reference to JIRA https://issues.apache.org/jira/browse/ATLAS-3776
> 
> 
> Diffs
> -----
> 
>   graphdb/common/src/main/java/org/apache/atlas/repository/graphdb/tinkerpop/query/TinkerpopGraphQuery.java
c70e8bfe8 
>   repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java 1a7bf6b16

>   repository/src/test/java/org/apache/atlas/discovery/EntitySearchProcessorTest.java
PRE-CREATION 
>   repository/src/test/java/org/apache/atlas/query/BasicTestSetup.java 9aa554ad5 
>   repository/src/test/java/org/apache/atlas/query/DSLQueriesTest.java 0bbff2f46 
> 
> 
> Diff: https://reviews.apache.org/r/72459/diff/4/
> 
> 
> Testing
> -------
> 
> tested on our dev env.
> 
> 
> Thanks,
> 
> Damian Warszawski
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message