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

(Updated Sept. 23, 2017, 1:11 a.m.)


Review request for atlas, Ashutosh Mestry, Madhan Neethiraj, and Sarath 
Subramanian.


Bugs: ATLAS-2151
    https://issues.apache.org/jira/browse/ATLAS-2151


Repository: atlas


Description
-------

While fixing the bugs surronding the index query generation, the case where 
multiple filters on a single entity attribute are specified was not being 
handled correctly. This would cause the index to return wrong results or a 
smaller dataset. 

level == 0 check in the constructIndexQuery led to this problem.

The fix is to encapsulate the entity filters index clauses within braces if 
there are more than one attribute filters.


Diffs (updated)
-----

  repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java 
64a86b93 


Diff: https://reviews.apache.org/r/62491/diff/2/

Changes: https://reviews.apache.org/r/62491/diff/1-2/


Testing
-------

mvn clean package -Pberkeley-elasticsearch works fine

Tested the REST call with following search parameters

```javascript

{
        "typeName": "hive_table",
        "excludeDeletedEntities": true,
        "classification" : "",
        "query": "",
        "limit": 10,
        "offset": 0,
        "entityFilters": {
                "condition": "AND",
                "criterion": [
                        {
                                "attributeName": "createTime",
                                "operator": "neq",
                                "attributeValue": "1491248917103"
                        },
                        {
                "attributeName": "name",
                "operator": "eq",
                "attributeValue": "testtable_0"
            }
                ]
        },
        "tagFilters": null,
        "attributes": ["createTime"]
}

{
        "typeName": "hive_table",
        "excludeDeletedEntities": true,
        "classification" : "",
        "query": "",
        "limit": 10,
        "offset": 0,
        "entityFilters": {
                "condition": "OR",
                "criterion": [
                        {
                                "attributeName": "name",
                                "operator": "eq",
                                "attributeValue": "testtable_1"
                        },
                        {
                "attributeName": "name",
                "operator": "eq",
                "attributeValue": "testtable_0"
            }
                ]
        },
        "tagFilters": null,
        "attributes": ["createTime"]
}

{
        "typeName": "hive_table",
        "excludeDeletedEntities": true,
        "classification" : "",
        "query": "",
        "limit": 10,
        "offset": 0,
        "entityFilters": {
            "attributeName": "createTime",
                "operator": "neq",
                "attributeValue": "1491248917103"
        },      
        "tagFilters": null,
        "attributes": ["createTime"]
}
```

Verified from logs that the index query is enclosed within braces for 
multi-filter attribute query and not when there's only one attribute (single) 
filter

Verified the results from REST calls (as UI doesn't support this use case)


Thanks,

Apoorv Naik

Reply via email to