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

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation of 
`stringify_values` in `superset/result_set.py` only catches `ValueError` when 
calling `stringify(val)`, which causes the process to crash if `stringify` 
raises a `TypeError` (e.g., for non-JSON-serializable objects). 
   
   To resolve this, you should update the `try...except` block to catch 
`TypeError` as well. Here is the corrected implementation for 
`superset/result_set.py`:
   
   ```python
                   try:
                       val = obj.item()
                       if isinstance(val, (dict, list)):
                           obj[...] = stringify(val)
                       else:
                           obj[...] = obj.astype(str)
                   except (ValueError, TypeError):
                       obj[...] = stringify(obj)
   ```
   
   This change ensures that if `stringify(val)` fails due to a `TypeError`, the 
code falls back to the original `stringify(obj)` behavior, preventing runtime 
crashes.
   
   **superset/result_set.py**
   ```
   try:
                       val = obj.item()
                       if isinstance(val, (dict, list)):
                           obj[...] = stringify(val)
                       else:
                           obj[...] = obj.astype(str)
                   except (ValueError, TypeError):
                       obj[...] = stringify(obj)
   ```


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