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

   ### 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.2
   
   ### What's Wrong?
   
   按照官方文档,创建明细基表:
   `create table sales_records(record_id int, seller_id int, store_id int, 
sale_date date, sale_amt bigint) distributed by hash(record_id) 
properties("replication_num" = "1");`
   
   建立物化视图:
   `create materialized view store_amt as select store_id, sum(sale_amt) from 
sales_records group by store_id;`
   
   插入数据:
   `insert into sales_records 
values(1,1,1,"2020-02-02",1),(1,2,2,"2020-02-02",1);`
   注意:这里store_id 不同。
   
   查询聚合数据:
   `SELECT store_id, sum(sale_amt) FROM sales_records GROUP BY store_id;`
   结果:
   
![image](https://github.com/apache/doris/assets/30048177/1357000d-9536-4b96-9783-b034e3c4a694)
   期望结果:
   应该有两条结果,分别表示 store_id=1和store_id=2的汇聚结果。
   
   explain确认走了物化视图:
   `EXPLAIN SELECT store_id, sum(sale_amt) FROM sales_records GROUP BY 
store_id;`
   
![image](https://github.com/apache/doris/assets/30048177/43787992-81b2-4421-89ad-ba91037b494e)
   
   另外:当我先建立明细表,然后插入多条明细数据,再建立物化视图后,查询结果是正确的,但当再次插入数据后,结果就不正确了。
   
   ### What You Expected?
   
   分组聚合结果正确
   
   ### How to Reproduce?
   
   按照问题里步骤操作
   
   ### 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