cambyzju opened a new pull request, #59340:
URL: https://github.com/apache/doris/pull/59340

   ### What problem does this PR solve?
   
   **Usage Example:**
   ```
   > select * from test_pk@ro where user_id=9820660;
   +---------+----------+
   | user_id | behavior |
   +---------+----------+
   | 9820660 | hello    |
   +---------+----------+
   ```
   
   
   - When there are overlapping key ranges in Paimon Primary Key table, we 
cannot use native reader:
   
   ```
   > explain verbose select * from test_pk where user_id=9820660;
   
+------------------------------------------------------------------------------------------------------------------------+
   | Explain String(Nereids Planner)                                            
                                            |
   
+------------------------------------------------------------------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                            
                                            |
   |   OUTPUT EXPRS:                                                            
                                            |
   |     user_id[#0]                                                            
                                            |
   |     behavior[#1]                                                           
                                            |
   |   PARTITION: UNPARTITIONED                                                 
                                            |
   |                                                                            
                                            |
   |   HAS_COLO_PLAN_NODE: false                                                
                                            |
   |                                                                            
                                            |
   |   VRESULT SINK                                                             
                                            |
   |      MYSQL_PROTOCAL                                                        
                                            |
   |                                                                            
                                            |
   |   1:VEXCHANGE                                                              
                                            |
   |      offset: 0                                                             
                                            |
   |      distribute expr lists:                                                
                                            |
   |      tuple ids: 0                                                          
                                            |
   |                                                                            
                                            |
   | PLAN FRAGMENT 1                                                            
                                            |
   |                                                                            
                                            |
   |   PARTITION: RANDOM                                                        
                                            |
   |                                                                            
                                            |
   |   HAS_COLO_PLAN_NODE: false                                                
                                            |
   |                                                                            
                                            |
   |   STREAM DATA SINK                                                         
                                            |
   |     EXCHANGE ID: 01                                                        
                                            |
   |     UNPARTITIONED                                                          
                                            |
   |                                                                            
                                            |
   |   0:VPAIMON_SCAN_NODE(79)                                                  
                                            |
   |      table: paimon_on_s3.db_paimon.test_pk                                 
                                            |
   |      predicates: (user_id[#0] = 9820660)                                   
                                            |
   |      inputSplitNum=1, totalFileSize=0, scanRanges=1                        
                                            |
   |      partition=1/0                                                         
                                            |
   |      backends:                                                             
                                            |
   |        1754986988417                                                       
                                            |
   |          /data-0891318b-4e3b-42b5-b85c-3bc8e9b8cc45-0.parquet start: 0 
length: 0                                       |
   |      cardinality=1001, numNodes=1                                          
                                            |
   |      pushdown agg=NONE                                                     
                                            |
   |      paimonNativeReadSplits=0/1                                            
                                            |
   |      predicatesFromPaimon:                                                 
                                            |
   |           Equal(user_id, 9820660)                                          
                                            |
   |      PaimonTable: test_pk                                                  
                                            |
   |      PaimonSplitStats:                                                     
                                            |
   |        SplitStat [type=JNI, rowCount=1001, mergedRowCount=NONE, 
rawFileConvertable=false, hasDeletionVector=false]     |
   |      tuple ids: 0                                                          
                                            |
   |                                                                            
                                            |
   | Tuples:                                                                    
                                            |
   | TupleDescriptor{id=0, tbl=test_pk}                                         
                                            |
   |   SlotDescriptor{id=0, col=user_id, colUniqueId=0, type=bigint, 
nullable=true, isAutoIncrement=false, subColPath=null} |
   |   SlotDescriptor{id=1, col=behavior, colUniqueId=1, type=text, 
nullable=true, isAutoIncrement=false, subColPath=null}  |
   |                                                                            
                                            |
   |                                                                            
                                            |
   |                                                                            
                                            |
   |                                                                            
                                            |
   | ========== STATISTICS ==========                                           
                                            |
   | planed with unknown column statistics                                      
                                            |
   
+------------------------------------------------------------------------------------------------------------------------+
   ```
   
   - But if we try to read `ro` table, we could use the Native reader with some 
data latency:
   
   ```
   > explain verbose select * from test_pk@ro where user_id=9820660;
   
+--------------------------------------------------------------------------------------------------------------------------------------+
   | Explain String(Nereids Planner)                                            
                                                          |
   
+--------------------------------------------------------------------------------------------------------------------------------------+
   | PLAN FRAGMENT 0                                                            
                                                          |
   |   OUTPUT EXPRS:                                                            
                                                          |
   |     user_id[#0]                                                            
                                                          |
   |     behavior[#1]                                                           
                                                          |
   |   PARTITION: UNPARTITIONED                                                 
                                                          |
   |                                                                            
                                                          |
   |   HAS_COLO_PLAN_NODE: false                                                
                                                          |
   |                                                                            
                                                          |
   |   VRESULT SINK                                                             
                                                          |
   |      MYSQL_PROTOCAL                                                        
                                                          |
   |                                                                            
                                                          |
   |   1:VEXCHANGE                                                              
                                                          |
   |      offset: 0                                                             
                                                          |
   |      distribute expr lists:                                                
                                                          |
   |      tuple ids: 0                                                          
                                                          |
   |                                                                            
                                                          |
   | PLAN FRAGMENT 1                                                            
                                                          |
   |                                                                            
                                                          |
   |   PARTITION: RANDOM                                                        
                                                          |
   |                                                                            
                                                          |
   |   HAS_COLO_PLAN_NODE: false                                                
                                                          |
   |                                                                            
                                                          |
   |   STREAM DATA SINK                                                         
                                                          |
   |     EXCHANGE ID: 01                                                        
                                                          |
   |     UNPARTITIONED                                                          
                                                          |
   |                                                                            
                                                          |
   |   0:VPAIMON_SCAN_NODE(79)                                                  
                                                          |
   |      table: paimon_on_s3.db_paimon.test_pk                                 
                                                          |
   |      predicates: (user_id[#0] = 9820660)                                   
                                                          |
   |      inputSplitNum=1, totalFileSize=519490, scanRanges=1                   
                                                          |
   |      partition=1/0                                                         
                                                          |
   |      backends:                                                             
                                                          |
   |        1754986988417                                                       
                                                          |
   |          
s3://warehouse/wh/db_paimon.db/test_pk/bucket-0/data-1ae9ee1e-e6aa-4594-9506-75b6b6ad3820-0.parquet
 start: 0 length: 519490 |
   |      cardinality=1001, numNodes=1                                          
                                                          |
   |      pushdown agg=NONE                                                     
                                                          |
   |      paimonNativeReadSplits=1/1                                            
                                                          |
   |      predicatesFromPaimon:                                                 
                                                          |
   |           Equal(user_id, 9820660)                                          
                                                          |
   |      PaimonTable: test_pk$ro                                               
                                                          |
   |      PaimonSplitStats:                                                     
                                                          |
   |        SplitStat [type=NATIVE, rowCount=1000, mergedRowCount=NONE, 
rawFileConvertable=true, hasDeletionVector=false]                 |
   |      tuple ids: 0                                                          
                                                          |
   |                                                                            
                                                          |
   | Tuples:                                                                    
                                                          |
   | TupleDescriptor{id=0, tbl=test_pk}                                         
                                                          |
   |   SlotDescriptor{id=0, col=user_id, colUniqueId=0, type=bigint, 
nullable=true, isAutoIncrement=false, subColPath=null}               |
   |   SlotDescriptor{id=1, col=behavior, colUniqueId=1, type=text, 
nullable=true, isAutoIncrement=false, subColPath=null}                |
   |                                                                            
                                                          |
   |                                                                            
                                                          |
   |                                                                            
                                                          |
   |                                                                            
                                                          |
   | ========== STATISTICS ==========                                           
                                                          |
   | planed with unknown column statistics                                      
                                                          |
   
+--------------------------------------------------------------------------------------------------------------------------------------+
   
   ```
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


-- 
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: [email protected]

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