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


   ### 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
   
   #6746 
   
   ### What's Wrong?
   
   The lateral view + subquery leads to the error join predicate ```equal join 
conjunct: `k3` = `k3` ```
   
   
   ### What You Expected?
   
   Only one join predicate ```equal join conjunct: `k1` = `k3````
   
   ### How to Reproduce?
   
   Steps:
   1. create table ```CREATE TABLE `test_explode` (
     `k1` int(11) NULL COMMENT "",
     `k2` varchar(1) NULL COMMENT ""
   ) ENGINE=OLAP
   DUPLICATE KEY(`k1`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`k1`) BUCKETS 5
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "in_memory" = "false",
   "storage_format" = "V2"
   ) ```
   2. query  ```MySQL [test]> explain select k1 from test_explode lateral view 
explode_split(k2, ",") tmp as e1  where k1 in (select k3 from tbl1);
   
+--------------------------------------------------------------------------------------+
   | Explain String                                                             
          |
   
+--------------------------------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                            
          |
   |  OUTPUT EXPRS:`k1`                                                         
          |
   |   PARTITION: UNPARTITIONED                                                 
          |
   |                                                                            
          |
   |   RESULT SINK                                                              
          |
   |                                                                            
          |
   |   6:EXCHANGE                                                               
          |
   |                                                                            
          |
   | PLAN FRAGMENT 1                                                            
          |
   |  OUTPUT EXPRS:                                                             
          |
   |   PARTITION: HASH_PARTITIONED: `k3`, `k1`                                  
          |
   |                                                                            
          |
   |   STREAM DATA SINK                                                         
          |
   |     EXCHANGE ID: 06                                                        
          |
   |     UNPARTITIONED                                                          
          |
   |                                                                            
          |
   |   3:HASH JOIN                                                              
          |
   |   |  join op: LEFT SEMI JOIN (PARTITIONED)                                 
          |
   |   |  hash predicates:                                                      
          |
   |   |  colocate: false, reason: The src data has been redistributed          
          |
   |   |  equal join conjunct: `k3` = `k3`                                      
          |
   |   |  equal join conjunct: `k1` = `k3`                                      
          |
   |   |  runtime filters: RF000[in] <- `k3`                                    
          |
   |   |  cardinality=-1                                                        
          |
   |   |                                                                        
          |
   |   |----5:EXCHANGE                                                          
          |
   |   |                                                                        
          |
   |   4:EXCHANGE                                                               
          |
   |                                                                            
          |
   | PLAN FRAGMENT 2                                                            
          |
   |  OUTPUT EXPRS:                                                             
          |
   |   PARTITION: HASH_PARTITIONED: `default_cluster:test`.`tbl1`.`k1`          
          |
   |                                                                            
          |
   |   STREAM DATA SINK                                                         
          |
   |     EXCHANGE ID: 05                                                        
          |
   |     HASH_PARTITIONED: `k3`, `k3`                                           
          |
   |                                                                            
          |
   |   2:OlapScanNode                                                           
          |
   |      TABLE: tbl1                                                           
          |
   |      PREAGGREGATION: OFF. Reason: No AggregateInfo                         
          |
   |      partitions=1/1                                                        
          |
   |      rollup: tbl1                                                          
          |
   |      tabletRatio=3/3                                                       
          |
   |      tabletList=14007,14009,14011                                          
          |
   |      cardinality=1                                                         
          |
   |      avgRowSize=983.0                                                      
          |
   |      numNodes=2                                                            
          |
   |                                                                            
          |
   | PLAN FRAGMENT 3                                                            
          |
   |  OUTPUT EXPRS:                                                             
          |
   |   PARTITION: HASH_PARTITIONED: `default_cluster:test`.`test_explode`.`k1`  
          |
   |                                                                            
          |
   |   STREAM DATA SINK                                                         
          |
   |     EXCHANGE ID: 04                                                        
          |
   |     HASH_PARTITIONED: `k3`, `k1`                                           
          |
   |                                                                            
          |
   |   1:TABLE FUNCTION NODE                                                    
          |
   |   |  table function: 
explode_split(`default_cluster:test`.`test_explode`.`k2`, ',')  |
   |   |  lateral view tuple id: 1                                              
          |
   |   |  output slot id: 2                                                     
          |
   |   |  cardinality=-1                                                        
          |
   |   |                                                                        
          |
   |   0:OlapScanNode                                                           
          |
   |      TABLE: test_explode                                                   
          |
   |      PREAGGREGATION: ON                                                    
          |
   |      runtime filters: RF000[in] -> `k1`                                    
          |
   |      partitions=1/1                                                        
          |
   |      rollup: test_explode                                                  
          |
   |      tabletRatio=5/5                                                       
          |
   |      tabletList=17010,17012,17014,17016,17018                              
          |
   |      cardinality=1                                                         
          |
   |      avgRowSize=842.0                                                      
          |
   |      numNodes=2                                                            
          |
   
+--------------------------------------------------------------------------------------+
   73 rows in set (2 min 19.321 sec) ```
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] 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

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