jollykingCN opened a new issue #5296:
URL: https://github.com/apache/incubator-doris/issues/5296


   **Describe the bug**
   If the sql can hit the materialized view, the query will be failed and in 
the fe.warn.log has Exception that 'Unknown column'  
   (sql查询一旦命中物化视图, FE就会报出Unknown column的异常而查询失败.)
   
   **To Reproduce**
   1. create db and table: t_event. its columns were: event_time_dayinweek / 
event_define_id / event_id / ... and so on.
   2. create materialized view
   ```sql
   create materialized view mv_dayinweek_count as 
   select 
     a.`event_time_dayinweek`, 
     a.`event_define_id`, 
     count(event_id)
   from t_event a 
   group by a.`event_time_dayinweek`, a.`event_define_id`;
   ```
   3. my query sql is:
   ```sql
   select 
     a.`event_time_dayinweek`, 
     event_define_id, 
     count(event_id)
   from t_event a 
   group by a.`event_time_dayinweek`,a.`event_define_id` 
   order by a.event_time_dayinweek, count(event_id);
   ```
   4. the query will be failed and in the fe.warn.log has Exception: 
   ``` 
   [StmtExecutor.analyze():507] Analyze failed because
   java.lang.IllegalStateException: org.apache.doris.common.AnalysisException: 
errCode = 2, detailMessage = Unknown column 'mv_count_event_id' in 
'default_cluster:smg_user_new_65.t_event'
        at org.apache.doris.analysis.Expr.analyzeNoThrow(Expr.java:535) 
~[palo-fe.jar:3.4.0]
        at 
org.apache.doris.rewrite.mvrewrite.CountFieldToSum.rewriteExpr(CountFieldToSum.java:95)
 ~[palo-fe.jar:3.4.0]
        at 
org.apache.doris.rewrite.mvrewrite.CountFieldToSum.apply(CountFieldToSum.java:83)
 ~[palo-fe.jar:3.4.0]
   ```
   
   **Doris Server Information**
    - Version: Baidu Doris(Palo) version 0.13.15-4e19c23
   


----------------------------------------------------------------
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.

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