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

Paresh Devalia updated ATLAS-5053:
----------------------------------
    Description: 
A regression issue has been identified in the /v2/search/basic API of Apache 
Atlas, where the recursive validation logic for entityFilters was 
unintentionally omitted in a previous fix.

As a result of this missing recursive check, the API is returning incorrect 
responses and throwing a Bad Request error for complex filter scenarios 
involving nested filter groups.

Example Request:

Endpoint:
http://localhost:21000/api/atlas/v2/search/basic

Request Body:

below is the json request: 
http://localhost:21000/api/atlas/v2/search/basic

{code:java}
{
  "excludeDeletedEntities": true,
  "includeSubClassifications": true,
  "includeSubTypes": true,
  "includeClassificationAttributes": true,
  "entityFilters": {
    "condition": "AND",
    "criterion": [
      {
        "attributeName": "__classificationNames",
        "operator": "eq",
        "attributeValue": "GameCatA"
      },
      {
        "condition": "AND",
        "criterion": [
          {
            "attributeName": "year_held",
            "operator": "eq",
            "attributeValue": "2006"
          }
        ]
      }
    ]
  },
  "tagFilters": null,
  "attributes": [
    "__classificationNames",
    "__typeName",
    "year_held"
  ],
  "limit": 25,
  "offset": 0,
  "typeName": "tournament",
  "classification": null,
  "termName": null
}
{code}


Observed Response:

{code:java}
{
  "errorCode": "ATLAS-400-00-103",
  "errorMessage": "Invalid operator specified for attribute: null"
}
{code}


As one can see, inside entity filter, we have criterion which in itself has 
condition and criterion i.e following nested pattern[recursively filtered], si 
in such case it gives: 
{
    "errorCode": "ATLAS-400-00-103",
    "errorMessage": "Invalid operator specified for attribute: null"
}

Root Cause:

The recursive structure in the entityFilters is not being properly validated. 
The current implementation only supports basic filter conditions (i.e., flat 
filters added using the "Add Filter" option) and fails to handle nested or 
grouped filters (i.e., filters added via "Add Filter Group").

  was:
Regression issue identified in the /v2/search/basic API of Apache Atlas, where 
recursive validation logic was unintentionally omitted in the previous fix.

Due to this missing recursive check, the API is returning incorrect results and 
bad request.

Example:

below is the json request: 
http://localhost:21000/api/atlas/v2/search/basic


{
  "excludeDeletedEntities": true,
  "includeSubClassifications": true,
  "includeSubTypes": true,
  "includeClassificationAttributes": true,
  "entityFilters": {
    "condition": "AND",
    "criterion": [
      {
        "attributeName": "__classificationNames",
        "operator": "eq",
        "attributeValue": "GameCatA"
      },
      {
        "condition": "AND",
        "criterion": [
          {
            "attributeName": "year_held",
            "operator": "eq",
            "attributeValue": "2006"
          }
        ]
      }
    ]
  },
  "tagFilters": null,
  "attributes": [
    "__classificationNames",
    "__typeName",
    "year_held"
  ],
  "limit": 25,
  "offset": 0,
  "typeName": "tournament",
  "classification": null,
  "termName": null
}


As one can see, inside entity filter, we have criterion which in itself has 
condition and criterion i.e following nested pattern[recursively filtered], si 
in such case it gives: 
{
    "errorCode": "ATLAS-400-00-103",
    "errorMessage": "Invalid operator specified for attribute: null"
}

So we will handle this Complex filter validation[i.e. Add Filter Group Option] 
in this Jira. Earlier it was only able to handle basic filter[i.e. normal Add 
Filter Option]


> Add recursive validation in Basic Search API to fix regression issue
> --------------------------------------------------------------------
>
>                 Key: ATLAS-5053
>                 URL: https://issues.apache.org/jira/browse/ATLAS-5053
>             Project: Atlas
>          Issue Type: Bug
>          Components:  atlas-core
>            Reporter: Paresh Devalia
>            Assignee: Aditya Gupta
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> A regression issue has been identified in the /v2/search/basic API of Apache 
> Atlas, where the recursive validation logic for entityFilters was 
> unintentionally omitted in a previous fix.
> As a result of this missing recursive check, the API is returning incorrect 
> responses and throwing a Bad Request error for complex filter scenarios 
> involving nested filter groups.
> Example Request:
> Endpoint:
> http://localhost:21000/api/atlas/v2/search/basic
> Request Body:
> below is the json request: 
> http://localhost:21000/api/atlas/v2/search/basic
> {code:java}
> {
>   "excludeDeletedEntities": true,
>   "includeSubClassifications": true,
>   "includeSubTypes": true,
>   "includeClassificationAttributes": true,
>   "entityFilters": {
>     "condition": "AND",
>     "criterion": [
>       {
>         "attributeName": "__classificationNames",
>         "operator": "eq",
>         "attributeValue": "GameCatA"
>       },
>       {
>         "condition": "AND",
>         "criterion": [
>           {
>             "attributeName": "year_held",
>             "operator": "eq",
>             "attributeValue": "2006"
>           }
>         ]
>       }
>     ]
>   },
>   "tagFilters": null,
>   "attributes": [
>     "__classificationNames",
>     "__typeName",
>     "year_held"
>   ],
>   "limit": 25,
>   "offset": 0,
>   "typeName": "tournament",
>   "classification": null,
>   "termName": null
> }
> {code}
> Observed Response:
> {code:java}
> {
>   "errorCode": "ATLAS-400-00-103",
>   "errorMessage": "Invalid operator specified for attribute: null"
> }
> {code}
> As one can see, inside entity filter, we have criterion which in itself has 
> condition and criterion i.e following nested pattern[recursively filtered], 
> si in such case it gives: 
> {
>     "errorCode": "ATLAS-400-00-103",
>     "errorMessage": "Invalid operator specified for attribute: null"
> }
> Root Cause:
> The recursive structure in the entityFilters is not being properly validated. 
> The current implementation only supports basic filter conditions (i.e., flat 
> filters added using the "Add Filter" option) and fails to handle nested or 
> grouped filters (i.e., filters added via "Add Filter Group").



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

Reply via email to