Skip to content

fix(schema): Fix HighestFieldID to include ListType ElementID - #609

Merged
zeroshade merged 1 commit into
apache:mainfrom
xixipi-lining:fix_highest_field_id
Oct 23, 2025
Merged

zeroshade merged 1 commit into
apache:mainfrom
xixipi-lining:fix_highest_field_id

Conversation

@xixipi-lining

Copy link
Copy Markdown
Contributor

Fix HighestFieldID to include ListType ElementID

The findLastFieldID visitor was ignoring ListType.ElementID, causing HighestFieldID() to return incorrect values.

Changes:

  • Fixed findLastFieldID.List() to include field.ElementID in calculation
  • Updated test cases to validate the fix

@xixipi-lining

Copy link
Copy Markdown
Contributor Author

When executing this code, schema.HighestFieldID() returns 1, but it should return 2 because the ListType contains an ElementID of 2, which is the highest field ID in the schema.

schema := iceberg.NewSchema(0, iceberg.NestedField{
	ID: 1,
	Type: &iceberg.ListType{
		ElementID:       2,
		Element:         iceberg.PrimitiveTypes.Bool,
		ElementRequired: true,
	},
	Required: true,
})

fmt.Println(schema.HighestFieldID())

@zeroshade
zeroshade merged commit 64f20c6 into apache:main Oct 23, 2025
@xixipi-lining
xixipi-lining deleted the fix_highest_field_id branch October 23, 2025 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants