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


   **Describe the bug**
   There are two table.
   
   colo:
   ```
   CREATE TABLE `colo` (
     `k1` tinyint(4) NULL COMMENT "",
     `k2` smallint(6) NULL COMMENT "",
     `k3` int(11) NULL COMMENT "",
     `k4` bigint(20) SUM NULL COMMENT ""
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`, `k2`, `k3`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`, `k2`, `k3`) BUCKETS 5
   CREATE TABLE `colo` (
     `k1` tinyint(4) NULL COMMENT "",
     `k2` smallint(6) NULL COMMENT "",
     `k3` int(11) NULL COMMENT "",
     `k4` bigint(20) SUM NULL COMMENT ""
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`, `k2`, `k3`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`, `k2`, `k3`) BUCKETS 5
   PROPERTIES (
   "replication_num" = "1",
   "colocate_with" = "g1",
   ```
   
   colo1:
   ```
   CREATE TABLE `colo1` (
     `k1` tinyint(4) NULL COMMENT "",
     `k2` smallint(6) NULL COMMENT "",
     `k3` int(11) NULL COMMENT "",
     `k4` bigint(20) SUM NULL COMMENT ""
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`, `k2`, `k3`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`, `k2`, `k3`) BUCKETS 5
   CREATE TABLE `colo` (
     `k1` tinyint(4) NULL COMMENT "",
     `k2` smallint(6) NULL COMMENT "",
     `k3` int(11) NULL COMMENT "",
     `k4` bigint(20) SUM NULL COMMENT ""
   ) ENGINE=OLAP
   AGGREGATE KEY(`k1`, `k2`, `k3`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`, `k2`, `k3`) BUCKETS 5
   PROPERTIES (
   "replication_num" = "1",
   "colocate_with" = "g2",
   ```
   
   There is important that: ***the colo and colo1 in different colocate 
group***; 
   
   if we execute the SQL:
   ```
    select * from 
   (select t1.k1 from colo t1, colo t2 where t1.k1 = t2.k1 and t1.k2 = t2.k2 
and t1.k3 = t2.k3 )t11 
   join[shuffle]
    (select t1.k1 from colo1 t1, colo1 t2 where t1.k1 = t2.k1 and t1.k2 = t2.k2 
and t1.k3 = t2.k3 ) t12
    on t11.k1 = t12.k1;
   ```
   
   try explain it:
   ```
   | PLAN FRAGMENT 1                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: HASH_PARTITIONED: `t1`.`k1`           |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 09                                |
   |     UNPARTITIONED                                  |
   |                                                    |
   |   6:HASH JOIN                                      |
   |   |  join op: INNER JOIN (PARTITIONED)             |
   |   |  hash predicates:                              |
   |   |  colocate: false, reason: Node type not match  |
   |   |  equal join conjunct: `t1`.`k1` = `t1`.`k1`    |
   |   |                                                |
   |   |----8:EXCHANGE                                  |
   |   |                                                |
   |   7:EXCHANGE                                       |
   |                                                    |
   | PLAN FRAGMENT 2                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 08                                |
   |     HASH_PARTITIONED: `t1`.`k1`                    |
   |                                                    |
   |   5:HASH JOIN                                      |
   |   |  join op: INNER JOIN                           |
   |   |  hash predicates:                              |
   |   |  colocate: true                                |
   |   |  equal join conjunct: `t1`.`k1` = `t2`.`k1`    |
   |   |  equal join conjunct: `t1`.`k2` = `t2`.`k2`    |
   |   |  equal join conjunct: `t1`.`k3` = `t2`.`k3`    |
   |   |                                                |
   |   |----4:OlapScanNode                              |
   |   |       TABLE: colo1                             |
   |   |       PREAGGREGATION: OFF. Reason: null        |
   |   |       partitions=1/1                           |
   |   |       rollup: colo1                            |
   |   |       tabletRatio=5/5                          |
   |   |       tabletList=23014,23016,23018,23020,23022 |
   |   |       cardinality=0                            |
   |   |       avgRowSize=0.0                           |
   |   |       numNodes=1                               |
   |   |                                                |
   |   3:OlapScanNode                                   |
   |      TABLE: colo1                                  |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo |
   |      partitions=1/1                                |
   |      rollup: colo1                                 |
   |      tabletRatio=5/5                               |
   |      tabletList=23014,23016,23018,23020,23022      |
   |      cardinality=0                                 |
   |      avgRowSize=0.0                                |
   |      numNodes=1                                    |
   |                                                    |
   | PLAN FRAGMENT 3                                    |
   |  OUTPUT EXPRS:                                     |
   |   PARTITION: RANDOM                                |
   |                                                    |
   |   STREAM DATA SINK                                 |
   |     EXCHANGE ID: 07                                |
   |     HASH_PARTITIONED: `t1`.`k1`                    |
   |                                                    |
   |   2:HASH JOIN                                      |
   |   |  join op: INNER JOIN                           |
   |   |  hash predicates:                              |
   |   |  colocate: true                                |
   |   |  equal join conjunct: `t1`.`k1` = `t2`.`k1`    |
   |   |  equal join conjunct: `t1`.`k2` = `t2`.`k2`    |
   |   |  equal join conjunct: `t1`.`k3` = `t2`.`k3`    |
   |   |                                                |
   |   |----1:OlapScanNode                              |
   |   |       TABLE: colo                              |
   |   |       PREAGGREGATION: OFF. Reason: null        |
   |   |       partitions=1/1                           |
   |   |       rollup: colo                             |
   |   |       tabletRatio=5/5                          |
   |   |       tabletList=17008,17010,17012,17014,17016 |
   |   |       cardinality=0                            |
   |   |       avgRowSize=0.0                           |
   |   |       numNodes=1                               |
   |   |                                                |
   |   0:OlapScanNode                                   |
   |      TABLE: colo                                   |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo |
   |      partitions=1/1                                |
   |      rollup: colo                                  |
   |      tabletRatio=5/5                               |
   |      tabletList=17008,17010,17012,17014,17016      |
   |      cardinality=0                                 |
   |      avgRowSize=0.0                                |
   |      numNodes=1                                    |
   
   ```
   
   execute the SQL report:
   ```
   failed to get tablet. tablet_id=23014, with schema_hash=659615493, 
reason=tablet does not exist
   ```
   
   Because the seqtoAddress map should be varible of Fragment, not the 
Coordinator.
   
   
   


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