korbit-ai[bot] commented on code in PR #33230:
URL: https://github.com/apache/superset/pull/33230#discussion_r2058889905


##########
superset/connectors/sqla/models.py:
##########
@@ -553,7 +560,11 @@ def handle_single_value(value: FilterValue | None) -> 
FilterValue | None:
                 ):
                     # For backwards compatibility and edge cases
                     # where a column data type might have changed
-                    return utils.cast_to_num(value)
+                    try:
+                        return utils.cast_to_num(float(value))
+                    except ValueError:
+                        logger.error(f"Unable to cast value {value} to num")
+                        return utils.cast_to_num(value)

Review Comment:
   The code still has redundant casting and unreachable code:
   1. `return utils.cast_to_num(float(value))` will exit the function, so 
`value = float(value)` never executes
   2. The fallback to `cast_to_num(value)` remains problematic as discussed
   



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