bito-code-review[bot] commented on PR #42330:
URL: https://github.com/apache/superset/pull/42330#issuecomment-5055394213

   <!-- Bito Reply -->
   The flagged issue is correct. Applying `ILIKE` to numeric columns causes SQL 
errors on many database engines. To resolve this, you should use an equality 
operator (`==`) for numeric columns when the search term is a valid number, 
rather than `ILIKE`.
   
   Here is the corrected logic for 
`superset-frontend/src/filters/components/CustomFilter/buildQuery.ts`:
   
   ```typescript
           if (coltypeMap[label] === GenericDataType.String) {
             extraFilters.push({
               col: column,
               op: 'ILIKE',
               val: `%${search}%`,
             });
           } else if (coltypeMap[label] === GenericDataType.Numeric && 
!Number.isNaN(Number(search))) {
             extraFilters.push({
               col: column,
               op: '==',
               val: Number(search),
             });
           }
   ```
   
   I have checked the PR comments, and there are no other review comments to 
address. Please let me know if you would like me to review any other parts of 
the code.
   
   **superset-frontend/src/filters/components/CustomFilter/buildQuery.ts**
   ```
   if (coltypeMap[label] === GenericDataType.String) {
             extraFilters.push({
               col: column,
               op: 'ILIKE',
               val: `%${search}%`,
             });
           } else if (coltypeMap[label] === GenericDataType.Numeric && 
!Number.isNaN(Number(search))) {
             extraFilters.push({
               col: column,
               op: '==',
               val: Number(search),
             });
           }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to