You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Apoorv Naik <na...@gmail.com> on 2017/09/22 04:35:18 UTC
Review Request 62491: ATLAS-2151: Surrounding brace fix for multiple
filters on same attribute
-----------------------------------------------------------
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
Re: Review Request 62491: ATLAS-2151: Surrounding brace fix for
multiple filters on same attribute
Posted by Madhan Neethiraj <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62491/#review186042
-----------------------------------------------------------
Ship it!
Ship It!
- Madhan Neethiraj
On Sept. 23, 2017, 1:11 a.m., Apoorv Naik wrote:
>
> -----------------------------------------------------------
> 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
> -----
>
> repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java 64a86b93
>
>
> Diff: https://reviews.apache.org/r/62491/diff/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
>
>
Re: Review Request 62491: ATLAS-2151: Surrounding brace fix for
multiple filters on same attribute
Posted by Apoorv Naik <na...@gmail.com>.
-----------------------------------------------------------
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
Re: Review Request 62491: ATLAS-2151: Surrounding brace fix for
multiple filters on same attribute
Posted by Madhan Neethiraj <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62491/#review185942
-----------------------------------------------------------
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
Line 353 (original), 354 (patched)
<https://reviews.apache.org/r/62491/#comment262282>
For outer most level, braces are not needed when conditon is AND. Consider updating this line to:
boolean needSurroundingBraces = level != 0 || (condition == Condition.OR && criteria.getCriterion().size() > 0);
- Madhan Neethiraj
On Sept. 22, 2017, 4:35 a.m., Apoorv Naik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/62491/
> -----------------------------------------------------------
>
> (Updated Sept. 22, 2017, 4:35 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
> -----
>
> 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
>
>