Skip to content

refactor(manifest)!: remove deprecated block size builder setter - #2325

Merged
zeroshade merged 9 commits into
apache:mainfrom
fallintoplace:refactor/manifest-no-block-size-setter-upstream-20261024
Oct 27, 2026
Merged

zeroshade merged 9 commits into
apache:mainfrom
fallintoplace:refactor/manifest-no-block-size-setter-upstream-20261024

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What

  • Remove DataFileBuilder.BlockSizeInBytes.

Why

  • The field is deprecated by the Iceberg spec.

Implementation

  • Remove the setter and keep the legacy field for reading v1 manifests.

Refs #2062.

Remove the public setter for a field deprecated by the Iceberg spec.
Preserve legacy v1 manifest decoding and projection coverage.

Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
@fallintoplace
fallintoplace force-pushed the refactor/manifest-no-block-size-setter-upstream-20261024 branch from 8badd5d to bc87cd0 Compare October 25, 2026 11:02

@badalprasadsingh badalprasadsingh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close to approval, but there are 2 things which definitely needs a look at.

Comment thread website/src/releases.md Outdated

### Unreleased compatibility notes

- **Deprecated data-file block-size setter removed.** `DataFileBuilder.BlockSizeInBytes` is no longer available. Reading the legacy block-size field from v1 manifests is unchanged.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add it back.

Comment thread manifest.go Outdated
}

// dataFile retains deprecated block_size_in_bytes for reading legacy v1
// manifests. New builders leave it at the required default; v2/v3 omit it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't the builders leave this at 0, causing v1 manifests to store 0? If so, this comment is incorrect.

As far as I checked last, Java writes 64 MiB, and our v1 schema declares the same default. Could you add omitzero to the tag so v1 writes that default? Also, TestManifestEntryProjectionWhitelistCoversDataFileSchema reads the raw tag, so it needs strings.Cut(name, ",").

BlockSizeInBytes int64 `avro:"block_size_in_bytes,omitzero"`

Comment thread manifest.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Please move the doc comment above dataFile onto BlockSizeInBytes field, check how DistinctCounts is written.

Comment thread manifest_projection_test.go Outdated
128,
)
require.NoError(t, err)
assert.Zero(t, builder.Build().(*dataFile).BlockSizeInBytes)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This line checks a field in memory, not something that gets written to the manifest. Same check running in all 5 cases, and calls Build() before the builder is done.

better to remove it.

If you take the omitzero suggestion, test this instead: write a v1 file without setting the field, then check that it reads back as 64mib.

@zeroshade

Copy link
Copy Markdown
Member

+1 to @badalprasadsingh's review. I checked both main points with a throwaway test. Building a data file without the setter and round-tripping a v1 manifest reads back block_size_in_bytes = 0, although the v1 schema says "Always write default in v1" with a 64 MiB default (internal/avro_schemas.go:251). Since nothing in the repo calls the setter, that's already what every v1 manifest we write contains, and removing the setter takes away the only workaround. With the tag changed to avro:"block_size_in_bytes,omitzero", the same round trip reads back 67108864, and TestManifestEntryProjectionWhitelistCoversDataFileSchema fails until it strips the tag options with strings.Cut(name, ","), as predicted. So please take the omitzero change, fix the comment, swap the in-memory assert.Zero check for the write-v1-then-read-64MiB test, and restore the compatibility note from b7bbe05.

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this takes all of @badalprasadsingh's points: omitzero makes unset v1 block sizes write the 64 MiB schema default, the doc moved onto the field, the whitelist test strips tag options, and the round-trip test pins the default (it fails if omitzero is removed). I pushed a merge of main (bd1e323) that keeps both releases.md notes. go vet ./... (including -tags integration) and go test . pass. LGTM. @badalprasadsingh, could you take another look?

@laskoviymishka laskoviymishka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this takes all of @badalprasadsingh's points: omitzero makes unset v1 block sizes write the 64 MiB schema default, the doc moved onto the field, the whitelist test strips tag options, and the round-trip test pins the default (it fails if omitzero is removed). I pushed a merge of main (f6b6d31) that keeps both releases.md notes. go vet ./... (including -tags integration) and go test . pass. LGTM.

@badalprasadsingh badalprasadsingh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :) all my points are addressed, thanks.

@zeroshade
zeroshade merged commit c7fe5a9 into apache:main Oct 27, 2026
16 checks passed
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.

4 participants