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


   **Describe the bug**
   
   DDL
   
   ```sql
   create table A(a1 bigint,a2 bigint)
   ENGINE=OLAP
   DISTRIBUTED BY HASH(a1) BUCKETS 1
   PROPERTIES (
   "replication_num" = "1"
   );
   
   insert into A values(1,1),
                       (2,2),
                       (3,3),
                       (4,4),
                       (5,5);
   
   create table B(b1 bigint,b2 bigint)
   ENGINE=OLAP
   DISTRIBUTED BY HASH(b1) BUCKETS 1
   PROPERTIES (
   "replication_num" = "1"
   );
   
   insert into B values(2,1),
                       (3,2),
                       (4,3),
                       (5,4);
   
   create table C(c1 bigint)
   ENGINE=OLAP
   DISTRIBUTED BY HASH(c1) BUCKETS 1
   PROPERTIES (
   "replication_num" = "1"
   );
   
   insert into C values(1),
                       (2),
                       (3),
                       (4);
   
   ```
   Join query
   
   ```sql
   select 
     t1.a1,
     t2.b2,
     sum(t1.a2) 
   from A t1
   
   left join (
     select b1,b2 from B
   ) t2
   
   on t1.a1=t2.b1
   
   join (
     select c1 from C
   ) t3
   
   on t2.b2 = t3.c1
   
   group by
   t1.a1,
   t2.b2
   ```
   
   Execute the SQL multiple times
   
   Result1
   
   ```sql
   +------+------+----------------+
   | a1   | b2   | sum(`t1`.`a2`) |
   +------+------+----------------+
   |    3 |    2 |              3 |
   |    2 |    1 |              2 |
   |    4 |    3 |              4 |
   +------+------+----------------+
   ```
   
   Result2
   
   ```sql
   +------+------+----------------+
   | a1   | b2   | sum(`t1`.`a2`) |
   +------+------+----------------+
   |    3 |    2 |              3 |
   |    2 |    1 |              2 |
   |    4 |    3 |              4 |
   |    5 |    4 |              5 |
   +------+------+----------------+
   ```
   
   
   


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

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