You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/11/05 03:54:05 UTC

[GitHub] [incubator-doris] banjin opened a new issue #7012: [Bug] 对于多表join后使用 GROUPING SETS结果不正确

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


   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Version
   
   PALO-0.15.1-rc03
   
   ### What's Wrong?
   
   使用join右的表中字段进行 grouping sets时候,字段为null的行被全量数据覆盖。
   
   ```sql
   select
   -- import_date, item_category0_name , item_category1_name, item_category2_name
   
   import_date, f.b item_category0_name, f.c item_category1_name, f.d item_category2_name
   from test
   left join (select import_date a, item_category0_name b, item_category1_name c, item_category2_name d from test) f
   on test.item_category0_name=f.b
   WHERE   test.item_category0_name IS NOT NULL
   GROUP BY GROUPING SETS ( (import_date, item_category0_name , item_category1_name, item_category2_name), (import_date, item_category0_name, item_category1_name), (import_date, item_category0_name))
   order by import_date, item_category0_name , item_category1_name, item_category2_name
   ```
   
   
   ```
   import_date, item_category0_name , item_category1_name, item_category2_name
   2021-10-30	包包	功能箱包	便当包
   2021-10-30	包包	功能箱包	便当包
   2021-10-30	包包	功能箱包	便当包
   2021-10-30	包包	功能箱包	户外包
   2021-10-30	包包	功能箱包	户外包
   2021-10-30	包包	功能箱包	户外包
   2021-10-30	包包	功能箱包	拉杆箱
   2021-10-30	包包	功能箱包	拉杆箱
   2021-10-30	包包	功能箱包	拉杆箱
   2021-10-30	包包	功能箱包	旅行袋
   2021-10-30	包包	功能箱包	旅行袋
   2021-10-30	包包	功能箱包	旅行袋
   2021-10-30	包包	功能箱包	箱包配件
   2021-10-30	包包	功能箱包	箱包配件
   2021-10-30	包包	功能箱包	箱包配件
   2021-10-30	包包	女包	单肩包
   2021-10-30	包包	女包	单肩包
   2021-10-30	包包	女包	单肩包
   2021-10-30	包包	女包	双肩背包
   2021-10-30	包包	女包	双肩背包
   2021-10-30	包包	女包	双肩背包
   2021-10-30	包包	女包	子母包
   2021-10-30	包包	女包	子母包
   2021-10-30	包包	女包	子母包
   2021-10-30	包包	女包	手拿包
   2021-10-30	包包	女包	手拿包
   2021-10-30	包包	女包	手拿包
   2021-10-30	包包	女包	手提包
   2021-10-30	包包	女包	手提包
   2021-10-30	包包	女包	手提包
   2021-10-30	包包	女包	手机包
   2021-10-30	包包	女包	手机包
   2021-10-30	包包	女包	手机包
   2021-10-30	包包	女包	腰包/胸包
   2021-10-30	包包	女包	腰包/胸包
   2021-10-30	包包	女包	腰包/胸包
   2021-10-30	包包	女包	钱包/卡包
   2021-10-30	包包	女包	钱包/卡包
   2021-10-30	包包	女包	钱包/卡包
   2021-10-30	包包	男包	手拿包/钱包
   2021-10-30	包包	男包	手拿包/钱包
   2021-10-30	包包	男包	手拿包/钱包
   2021-10-30	包包	男包	手提包
   2021-10-30	包包	男包	手提包
   2021-10-30	包包	男包	手提包
   2021-10-30	包包	男包	斜挎/单肩包
   2021-10-30	包包	男包	斜挎/单肩包
   2021-10-30	包包	男包	斜挎/单肩包
   2021-10-30	包包	男包	背包
   2021-10-30	包包	男包	背包
   2021-10-30	包包	男包	背包
   2021-10-30	包包	男包	腰包/胸包
   2021-10-30	包包	男包	腰包/胸包
   2021-10-30	包包	男包	腰包/胸包
   2021-10-30	大码女装	大码上装	大码T恤
   2021-10-30	大码女装	大码上装	大码T恤
   2021-10-30	大码女装	大码上装	大码T恤
   2021-10-30	大码女装	大码上装	大码背心/吊带
   2021-10-30	大码女装	大码上装	大码背心/吊带
   2021-10-30	大码女装	大码上装	大码背心/吊带
   2021-10-30	大码女装	大码上装	大码雪纺衫
   2021-10-30	大码女装	大码上装	大码雪纺衫
   2021-10-30	大码女装	大码上装	大码雪纺衫
   2021-10-30	大码女装	大码下装	大码半身裙
   2021-10-30	大码女装	大码下装	大码半身裙
   2021-10-30	大码女装	大码下装	大码半身裙
   2021-10-30	大码女装	大码下装	大码短裤
   2021-10-30	大码女装	大码下装	大码短裤
   2021-10-30	大码女装	大码下装	大码短裤
   2021-11-04	鞋子	男鞋	户外&登山
   2021-11-04	鞋子	男鞋	户外&登山
   2021-11-04	鞋子	男鞋	户外&登山
   2021-11-04	鞋子	男鞋	拖鞋
   2021-11-04	鞋子	男鞋	拖鞋
   2021-11-04	鞋子	男鞋	拖鞋
   2021-11-04	鞋子	男鞋	正装皮鞋
   2021-11-04	鞋子	男鞋	正装皮鞋
   2021-11-04	鞋子	男鞋	正装皮鞋
   2021-11-04	鞋子	男鞋	运动鞋
   2021-11-04	鞋子	男鞋	运动鞋
   2021-11-04	鞋子	男鞋	运动鞋
   2021-11-04	鞋子	男鞋	靴子
   2021-11-04	鞋子	男鞋	靴子
   2021-11-04	鞋子	男鞋	靴子
   2021-11-04	鞋子	鞋配件	前掌垫
   2021-11-04	鞋子	鞋配件	前掌垫
   2021-11-04	鞋子	鞋配件	前掌垫
   2021-11-04	鞋子	鞋配件	鞋带
   2021-11-04	鞋子	鞋配件	鞋带
   2021-11-04	鞋子	鞋配件	鞋带
   
   
   
   ```
   
   
   
   
   
   
   
   
   
   
   
   
   ### What You Expected?
   
   
   正确结果应该是在返回结果中包含NULL的行,如下实例
   
   
   ```sql
   select
   import_date, item_category0_name , item_category1_name, item_category2_name
   
   -- import_date, f.b item_category0_name, f.c item_category1_name, f.d item_category2_name
   from test
   left join (select import_date a, item_category0_name b, item_category1_name c, item_category2_name d from test) f
   on test.item_category0_name=f.b
   WHERE   test.item_category0_name IS NOT NULL
   GROUP BY GROUPING SETS ( (import_date, item_category0_name , item_category1_name, item_category2_name), (import_date, item_category0_name, item_category1_name), (import_date, item_category0_name))
   order by import_date, item_category0_name , item_category1_name, item_category2_name
   
   ```
   
   ```
                 import_date, item_category0_name , item_category1_name, item_category2_name
                 2021-10-30	包包		
                 2021-10-30	包包	功能箱包	
                 2021-10-30	包包	功能箱包	便当包
                 2021-10-30	包包	功能箱包	户外包
                 2021-10-30	包包	功能箱包	拉杆箱
                 2021-10-30	包包	功能箱包	旅行袋
                 2021-10-30	包包	功能箱包	箱包配件
                 2021-10-30	包包	女包	
                 2021-10-30	包包	女包	单肩包
                 2021-10-30	包包	女包	双肩背包
                 2021-10-30	包包	女包	子母包
                 2021-10-30	包包	女包	手拿包
                 2021-10-30	包包	女包	手提包
                 2021-10-30	包包	女包	手机包
                 2021-10-30	包包	女包	腰包/胸包
                 2021-10-30	包包	女包	钱包/卡包
                 2021-10-30	包包	男包	
                 2021-10-30	包包	男包	手拿包/钱包
                 2021-10-30	包包	男包	手提包
                 2021-10-30	包包	男包	斜挎/单肩包
                 2021-10-30	包包	男包	背包
                 2021-10-30	包包	男包	腰包/胸包
                 2021-10-30	大码女装		
                 2021-10-30	大码女装	大码上装	
                 2021-10-30	大码女装	大码上装	大码T恤
                 2021-10-30	大码女装	大码上装	大码背心/吊带
                 2021-10-30	大码女装	大码上装	大码雪纺衫
                 2021-10-30	大码女装	大码下装	
                 2021-10-30	大码女装	大码下装	大码半身裙
                 2021-10-30	大码女装	大码下装	大码短裤
                 2021-11-04	鞋子		
                 2021-11-04	鞋子	男鞋	
                 2021-11-04	鞋子	男鞋	户外&登山
                 2021-11-04	鞋子	男鞋	拖鞋
                 2021-11-04	鞋子	男鞋	正装皮鞋
                 2021-11-04	鞋子	男鞋	运动鞋
                 2021-11-04	鞋子	男鞋	靴子
                 2021-11-04	鞋子	鞋配件	
                 2021-11-04	鞋子	鞋配件	前掌垫
                 2021-11-04	鞋子	鞋配件	鞋带
   
   ```
   
   
   
   
   
   
   
   ### How to Reproduce?
   
   表中实际数据如下
   
   
   mysql> select import_date,  item_category0_name , item_category1_name, item_category2_name from test;
   
   ```
   
   +-------------+---------------------+---------------------+---------------------+
   | import_date | item_category0_name | item_category1_name | item_category2_name |
   +-------------+---------------------+---------------------+---------------------+
   | 2021-11-04  | 鞋子                | 男鞋                | 户外&登山           |
   | 2021-11-04  | 鞋子                | 男鞋                | 拖鞋                |
   | 2021-11-04  | 鞋子                | 男鞋                | 正装皮鞋            |
   | 2021-11-04  | 鞋子                | 男鞋                | 运动鞋              |
   | 2021-11-04  | 鞋子                | 男鞋                | 靴子                |
   | 2021-11-04  | 鞋子                | 鞋配件              | 前掌垫              |
   | 2021-11-04  | 鞋子                | 鞋配件              | 鞋带                |
   | 2021-10-30  | 包包                | 功能箱包            | 便当包              |
   | 2021-10-30  | 包包                | 功能箱包            | 户外包              |
   | 2021-10-30  | 包包                | 功能箱包            | 拉杆箱              |
   | 2021-10-30  | 包包                | 功能箱包            | 旅行袋              |
   | 2021-10-30  | 包包                | 功能箱包            | 箱包配件            |
   | 2021-10-30  | 包包                | 女包                | 单肩包              |
   | 2021-10-30  | 包包                | 女包                | 双肩背包            |
   | 2021-10-30  | 包包                | 女包                | 子母包              |
   | 2021-10-30  | 包包                | 女包                | 手拿包              |
   | 2021-10-30  | 包包                | 女包                | 手提包              |
   | 2021-10-30  | 包包                | 女包                | 手机包              |
   | 2021-10-30  | 包包                | 女包                | 腰包/胸包           |
   | 2021-10-30  | 包包                | 女包                | 钱包/卡包           |
   | 2021-10-30  | 包包                | 男包                | 手拿包/钱包         |
   | 2021-10-30  | 包包                | 男包                | 手提包              |
   | 2021-10-30  | 包包                | 男包                | 斜挎/单肩包         |
   | 2021-10-30  | 包包                | 男包                | 背包                |
   | 2021-10-30  | 包包                | 男包                | 腰包/胸包           |
   | 2021-10-30  | 大码女装            | 大码上装            | 大码T恤             |
   | 2021-10-30  | 大码女装            | 大码上装            | 大码背心/吊带       |
   | 2021-10-30  | 大码女装            | 大码上装            | 大码雪纺衫          |
   | 2021-10-30  | 大码女装            | 大码下装            | 大码半身裙          |
   | 2021-10-30  | 大码女装            | 大码下装            | 大码短裤            |
   +-------------+---------------------+---------------------+---------------------+
   
   ### 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-unsubscribe@doris.apache.org

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



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


[GitHub] [incubator-doris] zenoyang commented on issue #7012: [Bug] 对于多表join后使用 GROUPING SETS结果不正确

Posted by GitBox <gi...@apache.org>.
zenoyang commented on issue #7012:
URL: https://github.com/apache/incubator-doris/issues/7012#issuecomment-1001497311


   +1


-- 
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-unsubscribe@doris.apache.org

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



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