rambleraptor commented on code in PR #2076:
URL: https://github.com/apache/iceberg-go/pull/2076#discussion_r4149235630
##########
schema.go:
##########
@@ -1486,15 +1486,29 @@ func buildAccessors(schema *Schema) (map[int]accessor,
error) {
type setFreshIDs struct {
oldIdToNew map[int]int
nextIDFunc func() int
+ visiting *Schema
+ base *Schema
}
func (s *setFreshIDs) getAndInc(currentID int) int {
- next := s.nextIDFunc()
+ next := s.idFor(currentID)
s.oldIdToNew[currentID] = next
return next
}
+func (s *setFreshIDs) idFor(currentID int) int {
+ if s.base != nil {
+ if name, ok := s.visiting.FindColumnName(currentID); ok {
+ if f, ok := s.base.FindFieldByName(name); ok {
+ return f.ID
+ }
+ }
+ }
+
+ return s.nextIDFunc()
Review Comment:
Added the comment and the guard
--
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]