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/06/22 10:47:13 UTC

[GitHub] [superset] EBoisseauSierra opened a new issue #15294: Order custom time grains by increasing duration

EBoisseauSierra opened a new issue #15294:
URL: https://github.com/apache/superset/issues/15294


   I have been able to define custom time grains (e.g. 15-minute time buckets — cf. #15037), as per [the `config.py` instructions](https://github.com/apache/superset/blob/1.1/superset/config.py#L498-L522):
   
   ```python
   # Define how to compute the custom time buckets
   TIME_GRAIN_ADDON_EXPRESSIONS = {
       'postgresql': {
           'PT6H': "date_trunc('day', {col}) + date_trunc('hour', {col})::int / 6 * interval '6 h'",
           'PT15M': "date_trunc('hour', {col}) + date_part('minute', {col})::int / 15 * interval '15 min'",
       },
   }
   
   # Register these custom time grain
   TIME_GRAIN_ADDONS = {
       "PT6H": "6 hours",
       "PT15M": "15 minutes",
   }
   ```
   
   My custom time grains are then sorted *after* the default time grains:
   
   ![time_grain_shadow](https://user-images.githubusercontent.com/37387755/122911070-d0dd3580-d34e-11eb-9d4b-a58bf7e422e8.png)
   
   ### Expected results
   
   I would expect all time grains to be sorted by increasing duration. In the example above:
   
   […]
   * minute
   * 15 minutes
   * hour
   * 6 hours
   * day
   
   […]
   
   ### Actual results
   
   My custom time grains are sorted after any default ones. Their relative order is defined by the by `TIME_GRAIN_ADDON_EXPRESSIONS` keys' order, and not `TIME_GRAIN_ADDONS`'s ones.
   
   #### How to reproduce the bug
   
   1. Define custom time grain in `superset_config.py`, as above,
   2. Go to Explore / {any Time Series chart}
   3. Click on the Time Grain dropdown menu.
   
   ### Environment
   
   - superset version: `superset 1.1.0`
   
   ### Checklist
   
   - [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't found one similar.


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


[GitHub] [superset] EBoisseauSierra edited a comment on issue #15294: Order custom time grains by increasing duration

Posted by GitBox <gi...@apache.org>.
EBoisseauSierra edited a comment on issue #15294:
URL: https://github.com/apache/superset/issues/15294#issuecomment-1057989686


   P.S.: it seems to be fixed in 1.4.1:
   ![Screenshot from 2022-03-03 12-19-04](https://user-images.githubusercontent.com/37387755/156563652-b595a25d-7b39-4853-acee-b4d450a430d6.png)
   
   And it looks like @eschutho is to thanks for [#13720](https://github.com/apache/superset/pull/13720), [released in 1.2.0](https://github.com/apache/superset/blob/1.2/CHANGELOG.md?plain=1#L97) :rocket: 


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


[GitHub] [superset] EBoisseauSierra edited a comment on issue #15294: Order custom time grains by increasing duration

Posted by GitBox <gi...@apache.org>.
EBoisseauSierra edited a comment on issue #15294:
URL: https://github.com/apache/superset/issues/15294#issuecomment-1057989686


   Note that it seems to be fixed in v1.4.1:
   ![Screenshot from 2022-03-03 12-19-04](https://user-images.githubusercontent.com/37387755/156563652-b595a25d-7b39-4853-acee-b4d450a430d6.png)
   
   P.S.: And it looks like @eschutho is to be thanked for [#13720](https://github.com/apache/superset/pull/13720) that has been [released in 1.2.0](https://github.com/apache/superset/blob/1.2/CHANGELOG.md?plain=1#L97)! :rocket: 


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


[GitHub] [superset] junlincc commented on issue #15294: Order custom time grains by increasing duration

Posted by GitBox <gi...@apache.org>.
junlincc commented on issue #15294:
URL: https://github.com/apache/superset/issues/15294#issuecomment-903033646


   @maxhui this one might be harder, but feel free to work on it. 


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


[GitHub] [superset] junlincc edited a comment on issue #15294: Order custom time grains by increasing duration

Posted by GitBox <gi...@apache.org>.
junlincc edited a comment on issue #15294:
URL: https://github.com/apache/superset/issues/15294#issuecomment-903033646


   @MaxHuiYYDS this one might be harder, but feel free to work on it. 


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


[GitHub] [superset] villebro commented on issue #15294: Order custom time grains by increasing duration

Posted by GitBox <gi...@apache.org>.
villebro commented on issue #15294:
URL: https://github.com/apache/superset/issues/15294#issuecomment-903062679


   I'd love to see work get started for adding support for arbitrary precision time grains, so you could just write e.g. 3 hours, 6 hours and it would just work (where supported by the db engine spec)


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


[GitHub] [superset] EBoisseauSierra commented on issue #15294: Order custom time grains by increasing duration

Posted by GitBox <gi...@apache.org>.
EBoisseauSierra commented on issue #15294:
URL: https://github.com/apache/superset/issues/15294#issuecomment-1057989686


   P.S.: it seems to be fixed in 1.4.1:
   ![Screenshot from 2022-03-03 12-19-04](https://user-images.githubusercontent.com/37387755/156563652-b595a25d-7b39-4853-acee-b4d450a430d6.png)
   


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


[GitHub] [superset] EBoisseauSierra closed issue #15294: Order custom time grains by increasing duration

Posted by GitBox <gi...@apache.org>.
EBoisseauSierra closed issue #15294:
URL: https://github.com/apache/superset/issues/15294


   


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