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 2021/07/15 18:45:55 UTC

[GitHub] [superset] suddjian commented on a change in pull request #15707: fix: use expected label in metrics map

suddjian commented on a change in pull request #15707:
URL: https://github.com/apache/superset/pull/15707#discussion_r670721149



##########
File path: superset/connectors/sqla/models.py
##########
@@ -1086,7 +1086,7 @@ def get_sqla_query(  # pylint: disable=too-many-arguments,too-many-locals,too-ma
 
         # To ensure correct handling of the ORDER BY labeling we need to reference the
         # metric instance if defined in the SELECT clause.
-        metrics_exprs_by_label = {m.name: m for m in metrics_exprs}
+        metrics_exprs_by_label = {m.key: m for m in metrics_exprs}

Review comment:
       I'd like to have more documentation on this as comments in the code. Would you mind adding a comment for like 942 describing what the purpose is of `key`, and also here specifying why we use the `key` attribute?

##########
File path: superset/connectors/sqla/models.py
##########
@@ -1086,7 +1086,7 @@ def get_sqla_query(  # pylint: disable=too-many-arguments,too-many-locals,too-ma
 
         # To ensure correct handling of the ORDER BY labeling we need to reference the
         # metric instance if defined in the SELECT clause.
-        metrics_exprs_by_label = {m.name: m for m in metrics_exprs}
+        metrics_exprs_by_label = {m.key: m for m in metrics_exprs}

Review comment:
       I'd like to have more documentation on this as comments in the code. Would you mind adding a comment for line 942 describing what the purpose is of `key`, and also here specifying why we use the `key` attribute?




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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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