dosubot[bot] commented on issue #33033:
URL: https://github.com/apache/superset/issues/33033#issuecomment-2785621114

   <!-- Greeting -->
   
你好,@xueyun0512!我是一个可以帮助你解决bug、回答问题并成为贡献者的机器人。如果你有任何问题或者需要帮助,请随时告诉我,我会在这里为你提供支持,直到有人工维护者回复你。
   
   <!-- Answer -->
   The error you're encountering is due to the SQL syntax used for timestamp 
truncation in Impala when using the impyla backend. The correct syntax for 
truncating timestamps in Impala is `DATE_TRUNC('minute', {col})` instead of 
`TRUNC(evttime, 'MI')`. The `DATE_TRUNC` function should be used with the 
appropriate time unit, such as 'minute', 'hour', etc. 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/impala.py)</sup>.
   
   To resolve this issue, modify your query to use `DATE_TRUNC` like this:
   
   ```sql
   SELECT DATE_TRUNC('minute', evttime) AS __timestamp, 
          SUM(CASE WHEN result = 1 THEN 1 ELSE 0 END) / COUNT(*) AS 
success_rate 
   FROM superset_mickey.impyla_test 
   GROUP BY DATE_TRUNC('minute', evttime) 
   ORDER BY success_rate ASC 
   LIMIT 10000
   ```
   
   This should help in resolving the SQL parsing error you're facing.
   
   
   <!-- 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/e089f6a1-3010-4de1-9f58-7466b02286c9?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/e089f6a1-3010-4de1-9f58-7466b02286c9?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/e089f6a1-3010-4de1-9f58-7466b02286c9?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/e089f6a1-3010-4de1-9f58-7466b02286c9?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/e089f6a1-3010-4de1-9f58-7466b02286c9?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/e089f6a1-3010-4de1-9f58-7466b02286c9?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/e089f6a1-3010-4de1-9f58-7466b02286c9?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]

Reply via email to