This is an automated email from the ASF dual-hosted git repository. villebro pushed a commit to branch 0.37 in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit 2fd965c6b3fea7ea74225fe7e0b6c9faed544f2f Author: Ville Brofeldt <[email protected]> AuthorDate: Sun Sep 20 13:22:55 2020 +0300 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 2e2bfcb..6e9a80d 100644 --- a/superset/utils/core.py +++ b/superset/utils/core.py @@ -1010,24 +1010,7 @@ def get_example_database() -> "Database": 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:
