wuyue92tree commented on issue #18733: URL: https://github.com/apache/superset/issues/18733#issuecomment-1041260823
> Hi @wuyue92tree, I remember that Kylin uses Apache Calcite for SQL Parser and [FLOOR](https://calcite.apache.org/docs/reference.html) is Calcite function. This seems like a backport issue and you should file it in Kylin community. Thanks for reply! in fact when doing query, superset generate sql for kylin base on https://github.com/apache/superset/blob/59b811ac5bf6ea64da8e9343fed28676001b9015/superset/db_engine_specs/kylin.py#L30-L40 So, I make a change here and It's work. Wait for a better solution ^_^ ``` _time_grain_expressions = { None: "{col}", "PT1S": "TIMESTAMPADD(SECOND, -(SECOND(CAST({col} AS TIMESTAMP))), CAST({col} AS TIMESTAMP))", "PT1M": "TIMESTAMPADD(SECOND, -(MINUTE(CAST({col} AS TIMESTAMP))*60+SECOND(CAST({col} AS TIMESTAMP))), CAST({col} AS TIMESTAMP))", "PT1H": "TIMESTAMPADD(SECOND, -(HOUR(CAST({col} AS TIMESTAMP))*60*60+MINUTE(CAST({col} AS TIMESTAMP))*60+SECOND(CAST({col} AS TIMESTAMP))), CAST({col} AS TIMESTAMP))", "P1D": "CAST(CAST({col} AS TIMESTAMP) AS DATE)", "P1W": "CAST(TIMESTAMPADD(DAY, -(DAYOFWEEK(CAST({col} AS TIMESTAMP))-1), CAST({col} AS TIMESTAMP)) AS DATE)", "P1M": "CAST(TIMESTAMPADD(DAY, -(DAYOFMONTH(CAST({col} AS TIMESTAMP))-1), CAST({col} AS TIMESTAMP)) AS DATE)", "P0.25Y": "CAST(TIMESTAMPADD(MONTH, (QUARTER(CAST({col} AS TIMESTAMP))-1)*3, CAST((CAST(YEAR(CAST({col} AS TIMESTAMP)) AS VARCHAR) + '-01-01 00:00:00') AS TIMESTAMP)) AS DATE)", "P1Y": "CAST(TIMESTAMPADD(DAY, -(DAYOFYEAR(CAST({col} AS TIMESTAMP))-1), CAST({col} AS TIMESTAMP)) AS DATE)", } ``` make spark support floor function like hive is hard for me, orz~ -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
