atlas-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apoorv Naik <naik.apo...@gmail.com>
Subject Review Request 62491: ATLAS-2151: Surrounding brace fix for multiple filters on same attribute
Date Fri, 22 Sep 2017 04:35:18 GMT

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

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
-----

  repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java d5e39236 


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


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


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