zeroshade commented on code in PR #767:
URL: https://github.com/apache/iceberg-go/pull/767#discussion_r2884624923


##########
table/pos_delete_partitioned_fanout_writer.go:
##########
@@ -132,12 +130,22 @@ func (p *positionDeletePartitionedFanoutWriter) 
processBatch(ctx context.Context
 }
 
 func (p *positionDeletePartitionedFanoutWriter) partitionPath(partitionContext 
partitionContext) (string, error) {
-       data := 
partitionRecord(slices.Collect(maps.Values(partitionContext.partitionData)))
        spec := p.metadata.PartitionSpecByID(int(partitionContext.specID))
        if spec == nil {
                return "", fmt.Errorf("unexpected missing partition spec in 
metadata for spec id %d", partitionContext.specID)
        }
 
+       data := make(partitionRecord, spec.NumFields())
+       i := 0
+       for field := range spec.Fields() {
+               val, ok := partitionContext.partitionData[field.FieldID]
+               if !ok {
+                       return "", fmt.Errorf("unexpected missing partition 
value for field id %d in spec id %d", field.FieldID, partitionContext.specID)
+               }
+               data[i] = val
+               i++
+       }

Review Comment:
   should we change the `Fields()` method of partition specs to follow the more 
common pattern of returning an iterator of `itr.Seq2[int, PartitionField]` so 
that this can be `for i, field := range spec.Fields()` ?
   
   It would just be changing `Fields()` to use `slices.All` instead of 
`slices.Values`. Thoughts? It would let us avoid this separately defined `i` var



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