Skip to content

Commit cbbabaf

Browse files
committed
Change type checking in _process_metric and _do_cast
1 parent f0a1475 commit cbbabaf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/databricks/labs/dqx/profiler/profiler.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def _process_metric(self, metric_name: str, metric_value: Any, metric: str, sm_d
216216
"""
217217
typ = field_types[metric_name]
218218
if metric_value is not None:
219-
if (typ in {T.IntegerType(), T.LongType()}) and metric in {"stddev", "mean"}:
219+
if metric in {"stddev", "mean"}:
220220
sm_dict[metric_name][metric] = float(metric_value)
221221
else:
222222
sm_dict[metric_name][metric] = self._do_cast(metric_value, typ)
@@ -443,7 +443,7 @@ def _do_cast(value: str | None, typ: T.DataType) -> Any | None:
443443
if not value:
444444
return None
445445
if isinstance(typ, T.IntegralType):
446-
return int(float(value))
446+
return int(value)
447447
if typ == T.DoubleType() or typ == T.FloatType():
448448
return float(value)
449449
if isinstance(typ, T.DecimalType):

0 commit comments

Comments
 (0)