bito-code-review[bot] commented on PR #44712:
URL: https://github.com/apache/superset/pull/44712#issuecomment-5847192127
<!-- Bito Reply -->
The issue is correct. When `{col}` is a four-digit year (integer), functions
like `DAYOFYEAR({col})` fail because they expect a date or timestamp type. To
resolve this, you should cast the column to a date or timestamp before applying
the time-grain function.
For example, in `superset/db_engine_specs/kylin.py`, you can update the
`_time_grain_expressions` to ensure the column is cast:
```python
TimeGrain.YEAR: (
"TIMESTAMPADD(DAY, 1 - DAYOFYEAR(CAST({col} AS TIMESTAMP)),
CAST({col} AS DATE))"
),
```
Would you like me to fetch all other comments on this PR to validate and
implement fixes for them as well?
**superset/db_engine_specs/kylin.py**
```
TimeGrain.YEAR: (
"TIMESTAMPADD(DAY, 1 - DAYOFYEAR(CAST({col} AS TIMESTAMP)),
CAST({col} AS DATE))"
),
```
--
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]