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/09/23 20:43:43 UTC

[GitHub] [superset] betodealmeida commented on a change in pull request #16795: feat: handle temporal columns in group bys

betodealmeida commented on a change in pull request #16795:
URL: https://github.com/apache/superset/pull/16795#discussion_r715138730



##########
File path: superset/db_engine_specs/druid.py
##########
@@ -100,3 +100,17 @@ def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]:
         if tt in (utils.TemporalType.DATETIME, utils.TemporalType.TIMESTAMP):
             return f"""TIME_PARSE('{dttm.isoformat(timespec="seconds")}')"""
         return None
+
+    @classmethod
+    def epoch_to_dttm(cls) -> str:
+        """
+        Convert from number of seconds since the epoch to a timestamp.
+        """
+        return "MILLIS_TO_TIMESTAMP({col} * 1000)"
+
+    @classmethod
+    def epoch_ms_to_dttm(cls) -> str:
+        """
+        Convert from number of milliseconds since the epoch to a timestamp.
+        """
+        return "MILLIS_TO_TIMESTAMP({col})"

Review comment:
       Yeah, I implemented `epoch_to_dttm` while working on a solution, and decided to leave it there even if I wasn't using it, and add `epoch_ms_to_dttm` for completeness.




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