prashant8530 opened a new pull request, #6706:
URL: https://github.com/apache/paimon/pull/6706

                                                                                
                                                                                
                                                          ### Purpose           
                                                                                
                                                                                
                                    
                                                                                
                                                                                
                                                             
   Linked issue: close #XXXX (add your issue number)                            
                                                                                
                                                             
                                                                                
                                                                                
                                                             
   Fix `PaimonMetadataApplier` to support append-only partitioned tables and 
prevent validation failures when partition key equals primary key.              
                                                                
                                                                                
                                                                                
                                                             
   **Problem:**                                                                 
                                                                                
                                                             
   `PaimonMetadataApplier.applyCreateTable()` unconditionally adds partition 
keys to primary keys, causing:                                                  
                                                                
   1. Append-only tables (no primary key) cannot have partitions                
                                                                                
                                                             
   2. When `partitionKeys = primaryKeys`, validation fails with: "Primary key 
constraint should not be same with partition fields"                            
                                                               
                                                                                
                                                                                
                                                             
   **Solution:**                                                                
                                                                                
                                                             
   Only add partition keys to primary keys when safe (non-empty PK and no 
conflict). This preserves existing behavior for composite keys while enabling 
append-only and partition-by-PK scenarios.                           
                                                                                
                                                                                
                                                             
   ### Tests                                                                    
                                                                                
                                                             
                                                                                
                                                                                
                                                             
   Existing tests validate the fix doesn't break current behavior. The change 
makes behavior less restrictive by allowing previously invalid schemas.         
                                                               
                                                                                
                                                                                
                                                             
   ### API and Format                                                           
                                                                                
                                                             
                                                                                
                                                                                
                                                             
   No API or storage format changes. This is a bug fix in schema creation 
logic.                                                                          
                                                                   
                                                                                
                                                                                
                                                             
   ### Documentation                                                            
                                                                                
                                                             
                                                                                
                                                                                
                                                             
   No new feature introduced. This fixes existing functionality to work as 
expected.  
   
   Issue: https://github.com/apache/paimon/issues/6705


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

Reply via email to