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 2022/03/18 01:18:18 UTC

[GitHub] [superset] zhaoyongjie commented on a change in pull request #19234: fix: adhoc column in legacy chart

zhaoyongjie commented on a change in pull request #19234:
URL: https://github.com/apache/superset/pull/19234#discussion_r829626994



##########
File path: superset/connectors/base/models.py
##########
@@ -339,11 +339,14 @@ def data_for_slices(  # pylint: disable=too-many-locals
                     or []
                 )
             else:
-                column_names.update(
-                    column
+                _columns = [

Review comment:
       Since code style limits the column width to 88 characters, not adding an extra variable will make the commits line larger. So I added an extra variable to make it more readable.
   
   ```
   diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py
   index b888f4afc..cc42d4e7f 100644
   --- a/superset/connectors/base/models.py
   +++ b/superset/connectors/base/models.py
   @@ -339,13 +339,17 @@ class BaseDatasource(
                        or []
                    )
                else:
   -                column_names.update([
   -                    utils.get_column_name(column)
   -                    if utils.is_adhoc_column(column)
   -                    else column
   -                    for column_param in COLUMN_FORM_DATA_PARAMS
   -                    for column in utils.get_iterable(form_data.get(column_param) or [])
   -                ])
   +                column_names.update(
   +                    [
   +                        utils.get_column_name(column)
   +                        if utils.is_adhoc_column(column)
   +                        else column
   +                        for column_param in COLUMN_FORM_DATA_PARAMS
   +                        for column in utils.get_iterable(
   +                            form_data.get(column_param) or []
   +                        )
   +                    ]
   +                )
   
            filtered_metrics = [
                metric
   ```




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