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/11/02 22:24:55 UTC

[GitHub] [superset] oscarostlundgs commented on issue #17143: Presto engine spec broken - Date column mapped to Datetime

oscarostlundgs commented on issue #17143:
URL: https://github.com/apache/superset/issues/17143#issuecomment-958278588


   I run Superset in a sandboxed corporate environment so not easy to create a PR. So there seems to be to solutions:
   1. Revert the conversion of SQL DATE types to Python DATE() types
   2. Change the convert_dttm method to accept DATETIME(). 
   
   1 may break the date adhoc filter (that you fixed in the previous PR). 
   
   I tried 2 with this patch: 
   ```
   --- presto.py	2021-11-02 17:46:57.561409000 -0400
   +++ presto-patched.py	2021-11-02 17:49:27.742966000 -0400
   @@ -748,7 +748,7 @@
            tt = target_type.upper()
            if tt == utils.TemporalType.DATE:
                return f"""from_iso8601_date('{dttm.date().isoformat()}')"""
   -        if tt == utils.TemporalType.TIMESTAMP:
   +        if tt == utils.TemporalType.TIMESTAMP or tt == utils.TemporalType.DATETIME:
                return f"""from_iso8601_timestamp('{dttm.isoformat(timespec="microseconds")}')"""  # pylint: disable=line-too-long
            return None
    
   ```
   
   That "works" but does have a side effect. The queries now **include** CURRENT_DATE as 
   ```
   SELECT 
     CURRENT_DATE, 
     CURRENT_DATE < from_iso8601_timestamp('2021-11-02T22:16:38.000000')
   ```
   Returns: 
   ```
   2021-11-02
   true
   ```
   
   So that's quite a breaking change as all existing dashboards are built with the assumption that today is excluded. 
   
   


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