Skip to content

Commit d11e04b

Browse files
committed
Fixes #apache#33206
1 parent 150b9a0 commit d11e04b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

superset/connectors/sqla/models.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,13 @@ def filter_values_handler( # pylint: disable=too-many-arguments # noqa: C901
528528
def handle_single_value(value: FilterValue | None) -> FilterValue | None:
529529
if operator == utils.FilterOperator.TEMPORAL_RANGE:
530530
return value
531+
532+
if (
533+
isinstance(value, (float, int))
534+
and target_generic_type == utils.GenericDataType.NUMERIC
535+
):
536+
value = float(value)
537+
531538
if (
532539
isinstance(value, (float, int))
533540
and target_generic_type == utils.GenericDataType.TEMPORAL
@@ -553,7 +560,11 @@ def handle_single_value(value: FilterValue | None) -> FilterValue | None:
553560
):
554561
# For backwards compatibility and edge cases
555562
# where a column data type might have changed
556-
return utils.cast_to_num(value)
563+
try:
564+
return utils.cast_to_num(float(value))
565+
except ValueError:
566+
logger.error(f"Unable to cast value {value} to num")
567+
return utils.cast_to_num(value)
557568
if value == NULL_STRING:
558569
return None
559570
if value == EMPTY_STRING:

0 commit comments

Comments
 (0)