You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/09/20 10:23:25 UTC
[incubator-superset] branch master updated: fix: simply
is_adhoc_metric (#10964)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 3d8f757 fix: simply is_adhoc_metric (#10964)
3d8f757 is described below
commit 3d8f757ac8c963936dad2d0527055a2347f799b8
Author: Ville Brofeldt <33...@users.noreply.github.com>
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 5ccb74a..86d7e9f 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: