chn5944 opened a new issue, #44037:
URL: https://github.com/apache/doris/issues/44037

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   2.0.0
   
   ### What's Wrong?
   
   when  create view  contains calculate field like "count(1)/count(distinct 
a.field)" doris report "errCode = 2, detailMessage = Unexpected exception: 
null", but nest a query can solve this;
   example:
   `
   create view dwv_1339409931378688(date comment "",dept comment "",avg_bed_day 
comment "") as
   select b.date as date, c.name as dept, round(count(1)/count(distinct 
a.resident_doctor), 2) as avg_bed_day
   from in_patient_daily b 
   join medical_record_homepage a on a.admission_dept_id = b.dept_id and 
(a.discharge_time is null or a.discharge_time > b.date) and a.admission_time <= 
b.date 
   join dept_table c on b.dept_id = c.id
   group by b.date, c.name
   `
   above will failed to create, but below will success
   
   `
   create view dwv_1339409931378688(date comment "",dept comment "",avg_bed_day 
comment "") as 
   select * from (
   select b.date as date, c.name as dept, round(count(1)/count(distinct 
a.resident_doctor), 2) as avg_bed_day
   from in_patient_daily b 
   join medical_record_homepage a on a.admission_dept_id = b.dept_id and 
(a.discharge_time is null or a.discharge_time > b.date) and a.admission_time <= 
b.date 
   join dept_table c on b.dept_id = c.id
   group by b.date, c.name) a
   `
   
   
   ### What You Expected?
   
   i want to know why
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to