dosubot[bot] commented on issue #33033:
URL: https://github.com/apache/superset/issues/33033#issuecomment-2785696159
<!-- Answer -->
To modify the SQL query generated in the dashboard building section to use
the correct Impala syntax for timestamp truncation, you should ensure that the
`_time_grain_expressions` in the `ImpalaEngineSpec` class are correctly
defined. The correct syntax for timestamp truncation in Impala is as follows:
```python
_time_grain_expressions = {
None: "{col}",
TimeGrain.MINUTE: "DATE_TRUNC('minute', {col})",
TimeGrain.HOUR: "DATE_TRUNC('hour', {col})",
TimeGrain.DAY: "DATE_TRUNC('day', {col})",
TimeGrain.WEEK: "DATE_TRUNC('week', {col})",
TimeGrain.MONTH: "DATE_TRUNC('month', {col})",
TimeGrain.QUARTER: "DATE_TRUNC('quarter', {col})",
TimeGrain.YEAR: "DATE_TRUNC('year', {col})",
}
```
Ensure that these expressions are used for the respective time grains when
truncating timestamps in your dashboard queries
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/impala.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/ed94f285-53ca-4f24-884f-1d78c314f49f?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/ed94f285-53ca-4f24-884f-1d78c314f49f?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/ed94f285-53ca-4f24-884f-1d78c314f49f?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/ed94f285-53ca-4f24-884f-1d78c314f49f?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/ed94f285-53ca-4f24-884f-1d78c314f49f?feedback_type=hallucination)
| [Bug
Report](https://app.dosu.dev/response-feedback/ed94f285-53ca-4f24-884f-1d78c314f49f?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/ed94f285-53ca-4f24-884f-1d78c314f49f?feedback_type=other)</sup>
--
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]