This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git


The following commit(s) were added to refs/heads/main by this push:
     new c7fe5a974 refactor(manifest)!: remove deprecated block size builder 
setter (#2325)
c7fe5a974 is described below

commit c7fe5a9747e4d7c7ee23ba80719267b5abbfb119
Author: Minh Vu <[email protected]>
AuthorDate: Tue Oct 27 07:58:34 2026 +0100

    refactor(manifest)!: remove deprecated block size builder setter (#2325)
    
    * refactor(manifest)!: remove deprecated block size builder setter
    
    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 <[email protected]>
    
    * docs(release): note v1 API compatibility change
    
    * chore: sync release notes with main to resolve conflicts
    
    * fix(manifest): write schema default for unset v1 block sizes
    
    * style(manifest): gofmt block size field and struct alignment
    
    ---------
    
    Signed-off-by: Minh Vu <[email protected]>
    Co-authored-by: Matt Topol <[email protected]>
---
 manifest.go                 | 25 ++++++++++---------------
 manifest_projection_test.go |  9 +++++++--
 website/src/releases.md     |  1 +
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/manifest.go b/manifest.go
index 029de6eee..577e6e04a 100644
--- a/manifest.go
+++ b/manifest.go
@@ -2601,14 +2601,16 @@ func fitDecimalBytes(bytes []byte, size int) ([]byte, 
error) {
 }
 
 type dataFile struct {
-       Content          ManifestEntryContent `avro:"content"`
-       projected        bool
-       Path             string                `avro:"file_path"`
-       Format           FileFormat            `avro:"file_format"`
-       PartitionData    map[string]any        `avro:"partition"`
-       RecordCount      int64                 `avro:"record_count"`
-       FileSize         int64                 `avro:"file_size_in_bytes"`
-       BlockSizeInBytes int64                 `avro:"block_size_in_bytes"`
+       Content       ManifestEntryContent `avro:"content"`
+       projected     bool
+       Path          string         `avro:"file_path"`
+       Format        FileFormat     `avro:"file_format"`
+       PartitionData map[string]any `avro:"partition"`
+       RecordCount   int64          `avro:"record_count"`
+       FileSize      int64          `avro:"file_size_in_bytes"`
+       // BlockSizeInBytes is kept for reading legacy v1 manifests. When unset,
+       // v1 writes its 64 MiB schema default, while v2/v3 omit the field.
+       BlockSizeInBytes int64                 
`avro:"block_size_in_bytes,omitzero"`
        ColSizes         *[]colMap[int, int64] `avro:"column_sizes"`
        ValCounts        *[]colMap[int, int64] `avro:"value_counts"`
        NullCounts       *[]colMap[int, int64] `avro:"null_value_counts"`
@@ -3163,13 +3165,6 @@ func NewDataFileBuilder(
        }, nil
 }
 
-// BlockSizeInBytes sets the block size in bytes for the data file. Deprecated 
in v2.
-func (b *DataFileBuilder) BlockSizeInBytes(size int64) *DataFileBuilder {
-       b.d.BlockSizeInBytes = size
-
-       return b
-}
-
 // ColumnSizes sets the column sizes for the data file.
 func (b *DataFileBuilder) ColumnSizes(sizes map[int]int64) *DataFileBuilder {
        b.d.ColSizes = mapToAvroColMap(sizes)
diff --git a/manifest_projection_test.go b/manifest_projection_test.go
index 3195f6a61..006d9d4e6 100644
--- a/manifest_projection_test.go
+++ b/manifest_projection_test.go
@@ -20,6 +20,7 @@ package iceberg
 import (
        "bytes"
        "reflect"
+       "strings"
        "sync"
        "testing"
 
@@ -36,6 +37,7 @@ func 
TestManifestEntryProjectionWhitelistCoversDataFileSchema(t *testing.T) {
        dataFileFields := make(map[string]struct{})
        for field := range dataFileType.Fields() {
                if name, ok := field.Tag.Lookup("avro"); ok {
+                       name, _, _ = strings.Cut(name, ",")
                        dataFileFields[name] = struct{}{}
                }
        }
@@ -214,7 +216,6 @@ func 
TestManifestEntryProjectionSupportsManifestVersionsAndDeletes(t *testing.T)
                        )
                        require.NoError(t, err)
                        builder.
-                               BlockSizeInBytes(64 * 1024).
                                ColumnSizes(map[int]int64{1: 64}).
                                ValueCounts(map[int]int64{1: 1}).
                                NullValueCounts(map[int]int64{1: 0}).
@@ -266,7 +267,7 @@ func 
TestManifestEntryProjectionSupportsManifestVersionsAndDeletes(t *testing.T)
                        assert.Empty(t, projected.DataFile().ValueCounts())
                        assert.Empty(t, projected.DataFile().LowerBoundValues())
                        if tt.version == 1 {
-                               assert.Equal(t, int64(64*1024), 
projected.DataFile().(*dataFile).BlockSizeInBytes)
+                               assert.Equal(t, int64(64*1024*1024), 
projected.DataFile().(*dataFile).BlockSizeInBytes)
                        }
                        if tt.entryContent == EntryContentPosDeletes && 
tt.format == PuffinFile {
                                require.NotNil(t, 
projected.DataFile().ReferencedDataFile())
@@ -295,6 +296,10 @@ func 
TestManifestEntryProjectionSupportsManifestVersionsAndDeletes(t *testing.T)
                        require.NoError(t, err)
                        require.NoError(t, fullReader.Close())
                        assert.Equal(t, map[int]int64{1: 64}, 
full.DataFile().ColumnSizes())
+                       if tt.version == 1 {
+                               // An unset builder field must serialize using 
the v1 schema default.
+                               assert.Equal(t, int64(64*1024*1024), 
full.DataFile().(*dataFile).BlockSizeInBytes)
+                       }
 
                        fs := iceio.NewMemFS()
                        require.NoError(t, fs.WriteFile(manifest.FilePath(), 
manifestBytes.Bytes()))
diff --git a/website/src/releases.md b/website/src/releases.md
index b24209296..4cfc00695 100644
--- a/website/src/releases.md
+++ b/website/src/releases.md
@@ -42,6 +42,7 @@ Per-release notes (highlights, breaking changes, 
contributors) are published on
 
 ### Unreleased compatibility notes
 
+- **Data file block size setter removed.** 
`iceberg.DataFileBuilder.BlockSizeInBytes` is removed. New v1 manifests use the 
Avro schema's 64 MiB default when the field is unset. V2/v3 omit this 
deprecated field, and legacy v1 values remain readable.
 - **View creation APIs take a named SQL representation.** 
`view.NewVersionFromSQL`, `view.CreateView`, `view.CreateViewWithIOProperties`, 
and `sql.Catalog.CreateView` now accept a `view.Representation{SQL: sql, 
Dialect: dialect}` instead of positional SQL/dialect strings. The dialect is 
required; Hive preserves the selected representation's dialect.
 
 - **View SQL representation construction uses named fields.** Replace 
`view.NewRepresentation(sql, dialect)` with 
`view.NewRepresentation(view.Representation{SQL: sql, Dialect: dialect})`. 
Serialized JSON is unchanged.

Reply via email to