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/02/14 08:14:05 UTC

[GitHub] [incubator-superset] fx19880617 commented on a change in pull request #9142: Support human readable datetime type for PinotDB

fx19880617 commented on a change in pull request #9142: Support human readable datetime type for PinotDB
URL: https://github.com/apache/incubator-superset/pull/9142#discussion_r379297153
 
 

 ##########
 File path: superset/db_engine_specs/pinot.py
 ##########
 @@ -44,13 +45,32 @@ def get_timestamp_expr(
         cls, col: ColumnClause, pdf: Optional[str], time_grain: Optional[str]
     ) -> TimestampExpression:
         is_epoch = pdf in ("epoch_s", "epoch_ms")
-        if not is_epoch:
-            raise NotImplementedError("Pinot currently only supports epochs")
+
         # The DATETIMECONVERT pinot udf is documented at
         # Per https://github.com/apache/incubator-pinot/wiki/dateTimeConvert-UDF
         # We are not really converting any time units, just bucketing them.
-        seconds_or_ms = "MILLISECONDS" if pdf == "epoch_ms" else "SECONDS"
-        tf = f"1:{seconds_or_ms}:EPOCH"
+        tf = ""
+        if not is_epoch:
+            try:
+                today = datetime.datetime.today()
+                today.strftime(str(pdf))
+            except ValueError:
+                raise NotImplementedError(
+                    "Pinot currently doesn't support date formate: " + str(pdf)
 
 Review comment:
   You are correct, now we support datetime format, so will raise a ValueError here.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org