From 3d8f757ac8c963936dad2d0527055a2347f799b8 Mon Sep 17 00:00:00 2001 From: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Date: Sun, 20 Sep 2020 13:22:55 +0300 Subject: [PATCH] fix: simply is_adhoc_metric (#10964) * fix: simply is_adhoc_metric * address comment --- superset/utils/core.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/superset/utils/core.py b/superset/utils/core.py index 5ccb74aa99fa1..86d7e9f7af6ca 100644 --- a/superset/utils/core.py +++ b/superset/utils/core.py @@ -1040,24 +1040,7 @@ def backend() -> str: def is_adhoc_metric(metric: Metric) -> bool: - if not isinstance(metric, dict): - return False - metric = cast(Dict[str, Any], metric) - return bool( - ( - ( - metric.get("expressionType") == AdhocMetricExpressionType.SIMPLE - and metric.get("column") - and cast(Dict[str, Any], metric["column"]).get("column_name") - and metric.get("aggregate") - ) - or ( - metric.get("expressionType") == AdhocMetricExpressionType.SQL - and metric.get("sqlExpression") - ) - ) - and metric.get("label") - ) + return isinstance(metric, dict) def get_metric_name(metric: Metric) -> str: