wisonwang commented on issue #12339:
URL: https://github.com/apache/superset/issues/12339#issuecomment-811608041


   i see the issue too.  And  maybe i found the reason:
   When create a chart with time grains, superset will use it's default 
db_engine grains(mysql, db2, clickhouse...), like clickhouse:
   
[https://github.com/apache/superset/blob/master/superset/db_engine_specs/clickhouse.py](https://github.com/apache/superset/blob/master/superset/db_engine_specs/clickhouse.py)
   
   code: 
   
   > class ClickHouseEngineSpec(BaseEngineSpec):  # pylint: 
disable=abstract-method
   >     """Dialect for ClickHouse analytical DB."""
   > 
   >     engine = "clickhouse"
   >     engine_name = "ClickHouse"
   > 
   >     time_secondary_columns = True
   >     time_groupby_inline = True
   > 
   >     _time_grain_expressions = {
   >         None: "{col}",
   >         "PT1M": "toStartOfMinute(toDateTime({col}))",
   >         "PT5M": "toDateTime(intDiv(toUInt32(toDateTime({col})), 300)*300)",
   >         "PT10M": "toDateTime(intDiv(toUInt32(toDateTime({col})), 
600)*600)",
   >         "PT15M": "toDateTime(intDiv(toUInt32(toDateTime({col})), 
900)*900)",
   >         "PT0.5H": "toDateTime(intDiv(toUInt32(toDateTime({col})), 
1800)*1800)",
   >         "PT1H": "toStartOfHour(toDateTime({col}))",
   >         "P1D": "toStartOfDay(toDateTime({col}))",
   >         "P1W": "toMonday(toDateTime({col}))",
   >         "P1M": "toStartOfMonth(toDateTime({col}))",
   >         "P0.25Y": "toStartOfQuarter(toDateTime({col}))",
   >         "P1Y": "toStartOfYear(toDateTime({col}))",
   >     }
   
   to fix this issue , you can change the code to support your  local time 
zone. or if you just need dt grains, you can just let zhe chart's time grains 
to null.
    


-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to