a!queryEntity is returning data on non-existent primary key ID and even on passing primary key value as empty or null

I've created a query entity which retrieves all the table data on the basis of just primary key of the table or entity as a filter. But, the provided a!queryEntity code is returning data on non-existent primary key ID and even on passing primary key value as empty or null as well.

For ex- There are two rows existing in the table with primary key (requestID) values "1" and "2" but if I pass value "3" or something else which is non-existent in table, still the code is returning some random data where my scenario is not to return any data. That's one thing, other is if I pass "requestID" as "NULL" or if it's Empty, the query is returning all rows present in the table, whereas in my code as you can see below I am returning "{}" on blank values of "requestID", which also is my requirement.

What needs to be modified to achieve both the requirements. Attached is the code and screenshots for understanding. Any help appreciated. Thanks 

a!queryEntity(
  entity: cons!OSR_ENTITY_T_REQUEST,
  query: a!query(
    logicalExpression: a!queryLogicalExpression(
      operator: "AND",
      filters: if(
        rule!OSR_RULE_General_APN_isValueBlank(
          ri!requestID
        ),
        {},
        {
          a!queryFilter(
            field: "RequestID",
            operator: "=",
            value: ri!requestID
          )
        }
      )
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: -1,
      sort: a!sortInfo(
        field: "RequestID",
        ascending: true
      )
    )
  ),
  fetchTotalCount: false
)
Returning all rows in table on passing no value or NULL: Returning all rows on NULL or Empty "requestID"                  No data on requestID 3: No data on requestID 3   

Returning some random data on requestID 3 in dashboard: Returning some random data on requestID 3 in dashboard

  Discussion posts and replies are publicly visible