You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/09/20 09:19:11 UTC

[GitHub] [incubator-superset] dpgaspar commented on a change in pull request #10964: fix: simply is_adhoc_metric

dpgaspar commented on a change in pull request #10964:
URL: https://github.com/apache/incubator-superset/pull/10964#discussion_r491671885



##########
File path: superset/utils/core.py
##########
@@ -1040,24 +1040,9 @@ 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")
-    )
+    if isinstance(metric, dict):

Review comment:
       nit: you can just `return isinstance(metric, dict)`




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org