anpilw opened a new issue, #41795:
URL: https://github.com/apache/superset/issues/41795

   ### Bug description
   
   Hi there seems to be an issue when using the **Server pagination** feature 
for Table charts (I'm not using the AG Grid V2 feature flag), when users try to 
search by a UUID column.
   I believe that probably the UUID columns are being added to the Search by 
column when perhaps they shouldn't.
   As far as I know, the Search by functionality only supports text columns and 
it only supports a basic starts with query.
   But for UUIDs the query would have to support casting or just use equality, 
which I guess is something not supported right now and probably we should just 
avoid UUID columns from appearing in the search dropdown.
   
   From my investigation, I think the issue lies in somewhere in the line 1455 
of TableChart.tsx:
   ```
     useEffect(() => {
       const options = (
         columns as unknown as ColumnWithLooseAccessor &
           {
             columnKey: string;
             sortType?: string;
           }[]
       )
         .filter(col => **col?.sortType === 'alphanumeric'**)
         .map(column => ({
           value: column.columnKey,
           label: column.columnKey,
         }));
   
       if (!isEqual(options, searchOptions)) {
         setSearchOptions(options || []);
       }
     }, [columns, searchOptions]);
   ```
   
https://github.com/apache/superset/blob/83826839a0a33da2c9cd7b9ff64db2260108d54a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx#L1455
   
   I believe the sort type is coming from the **getSortTypeByDataType** 
function in the same file:
   function getSortTypeByDataType(dataType: GenericDataType): DefaultSortTypes {
     if (dataType === GenericDataType.Temporal) {
       return 'datetime';
     }
     if (dataType === GenericDataType.String) {
       return 'alphanumeric';
     }
     return 'basic';
   }
   
   So I suppose UUID are being mapped as **GenericDataType.String** and then we 
get the following query issue:
   
   `Error: Received ClickHouse exception, code: 43, server response: Code: 43. 
DB::Exception: Illegal type UUID of argument of function ilike: In scope SELECT 
event_time AS event_time, event_id AS event_id, user_id AS user_id, event_type 
AS event_type FROM default.user_events WHERE (event_time >= 
toDateTime('2026-07-03 00:04:46')) AND (event_time < toDateTime('2026-07-06 
09:04:46')) AND (event_id ILIKE 'eae8b2f8-8a36-4a89-9fe7-ecd711468bc1%') LIMIT 
10. (ILLEGAL_TYPE_OF_ARGUMENT) (for url http://host.docker.internal:8123)`
   
   The issue also happens if I just search by the initial characters in the 
UUID column.
   
   ### Screenshots/recordings
   
   Chart query error:
   <img width="1904" height="641" alt="Image" 
src="https://github.com/user-attachments/assets/4e66a694-1c1f-488d-8c97-ed06bb7abc2c";
 />
   
   Chart definition:
   <img width="1919" height="691" alt="Image" 
src="https://github.com/user-attachments/assets/ccd40722-bdd5-40fc-b10e-ea82f34ff306";
 />
   
   Dataset:
   
   <img width="751" height="711" alt="Image" 
src="https://github.com/user-attachments/assets/f14e569e-8088-473b-9af2-c9c3a6734207";
 />
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   This probably happens with any data source that supports UUID columns, but I 
tested with PostgreSQL and ClickHouse.
   I am NOT using the **AG_GRID_TABLE_ENABLED** feature flag.
   
   Here is the stack trace when using ClickHouse as database:
   
   ```
   WARNING:superset.models.helpers:Query SELECT COUNT(*) AS `rowcount` 
   
   FROM (SELECT `event_time` AS `event_time`, `event_id` AS `event_id`, 
`user_id` AS `user_id`, `event_type` AS `event_type` 
   
   FROM `default`.`user_events` 
   
   WHERE `event_time` >= toDateTime('2026-07-03 00:04:46') AND `event_time` < 
toDateTime('2026-07-06 09:04:46') AND `event_id` ILIKE 
'eae8b2f8-8a36-4a89-9fe7-ecd711468bc1%'
   
    LIMIT 500000) AS `rowcount_qry` on schema default failed
   
   Traceback (most recent call last):
   
     File "/app/superset/models/helpers.py", line 1565, in query
   
       df = self.database.get_df(
   
            ^^^^^^^^^^^^^^^^^^^^^
   
     File "/app/superset/models/core.py", line 906, in get_df
   
       cursor, rows, description = self._execute_sql_with_mutation_and_logging(
   
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
     File "/app/superset/models/core.py", line 859, in 
_execute_sql_with_mutation_and_logging
   
       self.db_engine_spec.execute(cursor, sql_, self)
   
     File "/app/superset/db_engine_specs/base.py", line 2192, in execute
   
       raise cls.get_dbapi_mapped_exception(ex) from ex
   
     File "/app/superset/db_engine_specs/base.py", line 2188, in execute
   
       cursor.execute(query)
   
     File 
"/app/.venv/lib/python3.11/site-packages/clickhouse_connect/dbapi/cursor.py", 
line 62, in execute
   
       query_result = self.client.query(operation, parameters)
   
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
     File 
"/app/.venv/lib/python3.11/site-packages/clickhouse_connect/driver/client.py", 
line 392, in query
   
       return self._query_with_context(query_context)
   
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
     File 
"/app/.venv/lib/python3.11/site-packages/clickhouse_connect/driver/httpclient.py",
 line 340, in _query_with_context
   
       response = self._raw_request(
   
                  ^^^^^^^^^^^^^^^^^^
   
   ```
   
   Stack trace for PostgreSQL:
   
   ```
   WARNING:superset.models.helpers:Query SELECT event_time AS event_time, 
event_id AS event_id, user_id AS user_id, event_type AS event_type 
   
   FROM public.user_events 
   
   WHERE event_id ILIKE 'eae8b2f8-8a36-4a89-9fe7-ecd711468bc1%' 
   
    LIMIT 10 on schema public failed
   
   Traceback (most recent call last):
   
     File "/app/superset/models/helpers.py", line 1565, in query
   
       df = self.database.get_df(
   
            ^^^^^^^^^^^^^^^^^^^^^
   
     File "/app/superset/models/core.py", line 906, in get_df
   
       cursor, rows, description = self._execute_sql_with_mutation_and_logging(
   
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
     File "/app/superset/models/core.py", line 859, in 
_execute_sql_with_mutation_and_logging
   
       self.db_engine_spec.execute(cursor, sql_, self)
   
     File "/app/superset/db_engine_specs/base.py", line 2192, in execute
   
       raise cls.get_dbapi_mapped_exception(ex) from ex
   
     File "/app/superset/db_engine_specs/base.py", line 2188, in execute
   
       cursor.execute(query)
   
   psycopg2.errors.UndefinedFunction: operator does not exist: uuid ~~* unknown
   
   LINE 3: WHERE event_id ILIKE 'eae8b2f8-8a36-4a89-9fe7-ecd711468bc1%'...
   
                          ^
   
   HINT:  No operator matches the given name and argument types. You might need 
to add explicit type casts.
   
   
   2026-07-06 09:25:02,271:WARNING:superset.models.helpers:Query SELECT 
COUNT(*) AS rowcount 
   
   FROM (SELECT event_time AS event_time, event_id AS event_id, user_id AS 
user_id, event_type AS event_type 
   
   FROM public.user_events 
   
   WHERE event_id ILIKE 'eae8b2f8-8a36-4a89-9fe7-ecd711468bc1%' 
   ```
   
   
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


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