TwinklerG opened a new issue, #2567:
URL: https://github.com/apache/iceberg-rust/issues/2567

   ### Apache Iceberg Rust version
   
   0.6.0 (latest version)
   
   ### Describe the bug
   
   When a partition field's transform is changed from `Identity` to `Void` (to 
effectively drop the field in v1 tables), re-binding the unbound partition spec 
to the schema fails because
     `check_name_does_not_collide_with_schema` treats `Void` the same as other 
non-Identity transforms and rejects the name collision.
   
   However, `Void` transforms always produce `null` results, so they pose no 
semantic conflict with schema columns — just like `Identity` transforms sourced 
from the same column. The check should allow Void
     transforms under the same condition as Identity.
   
   ### To Reproduce
   
   ```rust                                                                      
                                                                                
                                            
   use iceberg::spec::{                                                         
                                                                                
                                            
       NestedField, PartitionSpec, Schema, Transform, Type, 
UnboundPartitionField, PrimitiveType,                                           
                                                                
   };                                                                           
                                                                                
                                            
                                                                                
                                                                                
                                            
   let schema = Schema::builder()                                               
                                                                                
                                            
       .with_fields(vec![                                                       
                                                                                
                                            
           NestedField::required(1, "id", 
Type::Primitive(PrimitiveType::Int)).into(),                                    
                                                                                
  
       ])                                                                       
                                                                                
                                            
       .build()                                                                 
                                                                                
                                            
       .unwrap();                                                               
                                                                                
                                            
                                                                                
                                                                                
                                            
   // Simulate a previously valid identity partition whose transform was 
changed to Void                                                                 
                                                   
   let unbound = UnboundPartitionField {                                        
                                                                                
                                            
       source_id: 1,                                                            
                                                                                
                                            
       field_id: Some(1000),                                                    
                                                                                
                                            
       name: "id".to_string(), // same name as schema column                    
                                                                                
                                            
       transform: Transform::Void,                                              
                                                                                
                                            
   };                                                                           
                                                                                
                                            
                                                                                
                                                                                
                                            
   // Binding back fails                                                        
                                                                                
                                            
   let err = PartitionSpec::builder(schema)                                     
                                                                                
                                            
       .add_unbound_field(unbound)                                              
                                                                                
                                            
       .unwrap_err();                                                           
                                                                                
                                            
                                                                                
                                                                                
                                            
   assert!(err.message().contains("conflicts with schema")); // currently 
passes (fails as expected)                                                      
                                                  
   // But it should succeed — Void transform produces only null, no semantic 
conflict                                                                        
                                               
   ```                                                                          
                                                                                
                                      
                                                                                
                                                                                
                  
   
   
   ### Expected behavior
   
   `check_name_does_not_collide_with_schema` should allow Void transforms when 
the partition name collides with a schema column and the source_id matches, 
treating Void the same as Identity for this check. 
   
   ### Willingness to contribute
   
   I can contribute a fix for this bug independently


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