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/03 10:16:20 UTC

[GitHub] [incubator-superset] villebro commented on a change in pull request #10774: fix: pivot table timestamp grouping

villebro commented on a change in pull request #10774:
URL: https://github.com/apache/incubator-superset/pull/10774#discussion_r482868623



##########
File path: superset/viz.py
##########
@@ -871,15 +895,10 @@ def get_data(self, df: pd.DataFrame) -> VizData:
         groupby = self.form_data.get("groupby") or []
         columns = self.form_data.get("columns") or []
 
-        def _format_datetime(value: Any) -> Optional[str]:
-            if isinstance(value, str):
-                return f"__timestamp:{datetime_to_epoch(pd.Timestamp(value))}"
-            return None
-
         for column_name in groupby + columns:
             column = self.datasource.get_column(column_name)
-            if column and column.type in ("DATE", "DATETIME", "TIMESTAMP"):
-                ts = df[column_name].apply(_format_datetime)
+            if column and column.is_temporal:

Review comment:
       Without calling `column.is_temporal`, Postgres datasources were not able to identify temporal columns e.g. `TIMESTAMP WITHOUT TIMEZONE`.




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