FrancescoCastaldi commented on issue #45481:
URL: https://github.com/apache/superset/issues/45481#issuecomment-6524023196

   ### Root Cause Analysis & Solution
   
   In `superset/db_engine_specs/base.py`, `_default_column_type_mappings` maps 
`smallint`, `int`, and `bigint` to `GenericDataType.NUMERIC`, but does not 
contain a mapping for `tinyint`.
   
   When filtering against a `tinyint` column on engines like Trino or AWS 
Athena (for example `WHERE status >= 2`), Superset falls back to treating the 
column as string, quoting the literal: `WHERE status >= '2'`. This triggers a 
database query failure:
   `TYPE_MISMATCH: Cannot apply operator: tinyint < varchar`.
   
   #### Solution
   In `_default_column_type_mappings`, add:
   ```python
   (
       re.compile(r"^tinyint", re.IGNORECASE),
       types.SmallInteger(),
       GenericDataType.NUMERIC,
   ),
   ```
   prior to `smallint`.
   
   Verified with unit tests in `tests/unit_tests/db_engine_specs/test_base.py` 
and committed to branch `fix/community-unanswered-issues` (commit 
`f260c55b252`) at 
https://github.com/FrancescoCastaldi/superset/tree/fix/community-unanswered-issues.
   


-- 
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