daviddallakyan2005 opened a new pull request, #43217:
URL: https://github.com/apache/superset/pull/43217
### SUMMARY
ClickHouse has had `toStartOfSecond()` since 20.5.0, but
`ClickHouseBaseEngineSpec._time_grain_expressions` started at `PT1M`. The
README (and the 6.1 docs snapshot) therefore marked SECOND as unsupported, even
though the engine already uses the matching `toStartOf*` helpers for minute,
hour, day, and the rest.
This adds one key, in the same shape as the existing entries:
```python
"PT1S": "toStartOfSecond(toDateTime({col}))"
```
Both ClickHouse drivers inherit it from the base spec. The generated README
table now marks SECOND as True, which also flips Common Time Grains from
Partial to Supported (all eight common grains are present). I did not add
`PT5S` / `PT30S`, and I did not touch other engines.
`toStartOfSecond` is not a recent ClickHouse addition — it landed in 20.5
(May 2020, ClickHouse/ClickHouse#10722). Current docs still type the argument
as `DateTime64`; wrapping with `toDateTime({col})` is the convention already
used by `toStartOfMinute` / `toStartOfHour` / `toStartOfDay` in this dict, and
ClickHouse converts `DateTime` for this function.
This is a one-expression fill-in on an existing engine spec, not a new
database or public API, so I did not file a SIP.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable; backend SQL expression only.
### TESTING INSTRUCTIONS
```bash
pytest -q tests/unit_tests/db_engine_specs/test_clickhouse.py
```
84 passed locally, including the new `test_time_grain_expressions` cases for
`None` / `PT1S` / `PT1M`. `pre-commit run` on the staged files is green.
To confirm in Explore against a ClickHouse database: pick a temporal column,
set Time Grain to Second, and check that the SQL contains
`toStartOfSecond(toDateTime(...))`.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]