[ 
https://issues.apache.org/jira/browse/ATLAS-5005?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paresh Devalia updated ATLAS-5005:
----------------------------------
    Description: 
When performing a basic search via the Atlas API, the filter with an invalid 
operator (e.g., {{{}"operator": "paresh"{}}}) results in returning all 
entities, instead of applying the filter correctly. In the Atlas UI, however, 
the filtering works as expected.
h3. Steps to Reproduce:
 # Send a POST request to the {{/api/atlas/v2/search/basic}} endpoint with the 
following payload
{code:java}
{
  "excludeDeletedEntities": true,
  "includeSubClassifications": true,
  "includeSubTypes": true,
  "includeClassificationAttributes": true,
  "entityFilters": {
    "condition": "AND",
    "criterion": [
        {
            "attributeName": "name",
            "operator": "paresh",
            "attributeValue": "paresh7"
        }
    ]
  },
  "tagFilters": null,
  "attributes": [],
  "limit": 25,
  "offset": 0,
  "typeName": "hive_table",
  "classification": null,
  "termName": null
}
 {code}

       2. Observe that all entities are returned, rather than filtering based 
on the operator provided.
h3. Expected Behavior:
 * The API should correctly filter entities based on the valid operators 
specified by Atlas (e.g., {{{}={}}}, {{{}!={}}}, {{{}contains{}}}, 
{{{}begin_with{}}}, {{{}ends_with{}}}, {{{}is_null{}}}, {{{}not_null{}}}).
 * The filter should only return entities that match the criteria specified in 
the request.

 

  was:
API call basic search entity filter validation is absence.

 
{code:java}
Request :- curl --location --request POST 
'http://localhost:21000/api/atlas/v2/search/basic' \--header 'Authorization: 
Basic YWRtaW46YWRtaW4=' \--header 'Content-Type: application/json' \--header 
'Cookie: ATLASSESSIONID=node04p3usz9fgsya171ul24be9io107.node0' \--data-raw '{  
  "excludeDeletedEntities": true,    "includeSubClassifications": true,    
"includeSubTypes": true,    "includeClassificationAttributes": true,    
"entityFilters": {        "condition": "AND",        "criterion": [            
{                "attributeName": "name",                "operator": "paresh",  
              "attributeValue": "paresh7"            }        ]    },    
"tagFilters": null,    "attributes": [],    "limit": 25,    "offset": 0,    
"typeName": "hive_table",    "classification": null,    "termName": null}' 

Response:- {    "queryType": "BASIC",    "searchParameters": {        
"typeName": "hive_table",        "excludeDeletedEntities": true,        
"includeClassificationAttributes": true,        "includeSubTypes": true,        
"includeSubClassifications": true,        "excludeHeaderAttributes": false,     
   "limit": 25,        "offset": 0,        "entityFilters": {            
"condition": "AND",            "criterion": [                {                  
  "attributeName": "name",                    "attributeValue": "paresh7"       
         }            ]        },        "attributes": []    },    "entities": 
[        {            "typeName": "hive_table",            "attributes": {      
          "owner": "",                "createTime": 1669974016149,              
  "qualifiedName": "paresh7",                "name": "paresh7",                
"description": "zzzzz"            },            "guid": 
"04b99291-ca09-4fc9-b6af-af63c2b5d2bc",            "status": "ACTIVE",          
  "displayText": "paresh7",            "classificationNames": [],            
"classifications": [],            "meaningNames": [],            "meanings": 
[],            "isIncomplete": false,            "labels": []        },        
{            "typeName": "hive_table",            "attributes": {               
 "owner": "",                "createTime": 1669974016149,                
"qualifiedName": "paresh8",                "name": "paresh7",                
"description": "zzzzz"            },            "guid": 
"d35ab796-1562-4686-92f2-4def0b5ea216",            "status": "ACTIVE",          
  "displayText": "paresh7",            "classificationNames": [],            
"classifications": [],            "meaningNames": [],            "meanings": 
[],            "isIncomplete": false,            "labels": []        },        
{            "typeName": "hive_table",            "attributes": {               
 "owner": "",                "createTime": 1669974016149,                
"qualifiedName": "paresh9",                "name": "paresh9",                
"description": "zzzzz"            },            "guid": 
"d979506b-a884-4161-810d-2a7568c3d398",            "status": "ACTIVE",          
  "displayText": "paresh9",            "classificationNames": [],            
"classifications": [],            "meaningNames": [],            "meanings": 
[],            "isIncomplete": false,            "labels": []        }    ],    
"approximateCount": 3}{code}
 

If we try to filter any attributes with *operator*  as random name, we fetch 
all the entity.

>From Atlas UI its is working fine,  Atlas support given operator (=, !=, 
>contains, begin_with, ends_with, is_null, not_null) 

 

 


> Basic search entity filter validation
> -------------------------------------
>
>                 Key: ATLAS-5005
>                 URL: https://issues.apache.org/jira/browse/ATLAS-5005
>             Project: Atlas
>          Issue Type: Bug
>          Components:  atlas-core
>            Reporter: Paresh Devalia
>            Assignee: Aditya Gupta
>            Priority: Major
>
> When performing a basic search via the Atlas API, the filter with an invalid 
> operator (e.g., {{{}"operator": "paresh"{}}}) results in returning all 
> entities, instead of applying the filter correctly. In the Atlas UI, however, 
> the filtering works as expected.
> h3. Steps to Reproduce:
>  # Send a POST request to the {{/api/atlas/v2/search/basic}} endpoint with 
> the following payload
> {code:java}
> {
>   "excludeDeletedEntities": true,
>   "includeSubClassifications": true,
>   "includeSubTypes": true,
>   "includeClassificationAttributes": true,
>   "entityFilters": {
>     "condition": "AND",
>     "criterion": [
>         {
>             "attributeName": "name",
>             "operator": "paresh",
>             "attributeValue": "paresh7"
>         }
>     ]
>   },
>   "tagFilters": null,
>   "attributes": [],
>   "limit": 25,
>   "offset": 0,
>   "typeName": "hive_table",
>   "classification": null,
>   "termName": null
> }
>  {code}
>        2. Observe that all entities are returned, rather than filtering based 
> on the operator provided.
> h3. Expected Behavior:
>  * The API should correctly filter entities based on the valid operators 
> specified by Atlas (e.g., {{{}={}}}, {{{}!={}}}, {{{}contains{}}}, 
> {{{}begin_with{}}}, {{{}ends_with{}}}, {{{}is_null{}}}, {{{}not_null{}}}).
>  * The filter should only return entities that match the criteria specified 
> in the request.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to