You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2022/08/22 13:18:16 UTC

[superset] 27/36: timestamp bug (#21130)

This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch chore/drill-to-detail-modal-tests
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 8c71070ba2cf1e122beb9a45188a1058a7907f13
Author: AAfghahi <48...@users.noreply.github.com>
AuthorDate: Thu Aug 18 18:20:25 2022 -0400

    timestamp bug (#21130)
---
 superset/models/helpers.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index e3111166ae..1ce534b593 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -1485,11 +1485,16 @@ class ExploreMixin:  # pylint: disable=too-many-public-methods
                     # if groupby field/expr equals granularity field/expr
                     if selected == granularity:
                         table_col = columns_by_name[selected]
-                        outer = table_col.get_timestamp_expression(
-                            time_grain=time_grain,
-                            label=selected,
-                            template_processor=template_processor,
-                        )
+                        if isinstance(table_col, dict):
+                            outer = self.get_timestamp_expression(
+                                table_col, time_grain, selected, template_processor
+                            )
+                        else:
+                            outer = table_col.get_timestamp_expression(
+                                time_grain=time_grain,
+                                label=selected,
+                                template_processor=template_processor,
+                            )
                     # if groupby field equals a selected column
                     elif selected in columns_by_name:
                         if isinstance(columns_by_name[selected], dict):