You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2026/01/27 16:21:05 UTC

[PR] fix(table): use proper data file names [iceberg-go]

zeroshade opened a new pull request, #702:
URL: https://github.com/apache/iceberg-go/pull/702

   fixes #697
   
   Follows the same standard as the java implementation to generate data file names appropriately.
   
   Adds a test to confirm the name generation.


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737858860


##########
table/writer.go:
##########
@@ -33,15 +33,18 @@ import (
 type WriteTask struct {
 	Uuid        uuid.UUID
 	ID          int
+	PartitionID int // Added: partition ID for file naming
+	FileCount   int // Added: file counter within this task
 	Schema      *iceberg.Schema
 	Batches     []arrow.RecordBatch
 	SortOrderID int
 }
 
 func (w WriteTask) GenerateDataFileName(extension string) string {
 	// Mimics the behavior in the Java API:
-	// https://github.com/apache/iceberg/blob/a582968975dd30ff4917fbbe999f1be903efac02/core/src/main/java/org/apache/iceberg/io/OutputFileFactory.java#L92-L101
-	return fmt.Sprintf("00000-%d-%s.%s", w.ID, w.Uuid, extension)
+	// https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/io/OutputFileFactory.java

Review Comment:
   that's a good point, i'll put it back



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2739970096


##########
table/writer.go:
##########
@@ -33,15 +33,18 @@ import (
 type WriteTask struct {
 	Uuid        uuid.UUID
 	ID          int
+	PartitionID int // Added: partition ID for file naming
+	FileCount   int // Added: file counter within this task

Review Comment:
   The "Added:" prefix in comments is typically used temporarily during code reviews but should be removed before merging to production. Standard Go documentation comments should describe what the field does, not that it was recently added. Consider updating these comments to describe the purpose of the field instead.
   ```suggestion
   	PartitionID int // PartitionID is the partition identifier used in data file naming.
   	FileCount   int // FileCount is a sequential counter for files written by this task.
   ```



##########
table/rolling_data_writer.go:
##########
@@ -156,13 +166,16 @@ func (r *RollingDataWriter) flushToDataFile(batch []arrow.RecordBatch, outputDat
 	}
 
 	task := iter.Seq[WriteTask](func(yield func(WriteTask) bool) {
-		cnt := int(r.factory.counter.Add(1) - 1)
+		cnt, _ := r.factory.nextCount()

Review Comment:
   This line calls `nextCount()` which is created by `iter.Pull()` in the writerFactory. According to Go's documentation, the functions returned by `iter.Pull` are not safe for concurrent use. Since multiple RollingDataWriter instances can call `flushToDataFile` concurrently (each in its own goroutine from the `stream` method), this creates a concurrency safety violation.
   
   The writerFactory needs to protect access to `nextCount()` with a mutex to ensure thread-safe counter increments across multiple partition writers.



##########
internal/utils.go:
##########
@@ -164,12 +165,15 @@ func RecoverError(err *error) {
 }
 
 func Counter(start int) iter.Seq[int] {
+	var current atomic.Int64
+	current.Store(int64(start))
+
 	return func(yield func(int) bool) {
 		for {
-			if !yield(start) {
+			if !yield(int(current.Load())) {
 				return
 			}
-			start++
+			current.Add(1)

Review Comment:
   There is a race condition in this implementation. The current code performs a Load followed by an Add in separate operations, which means two concurrent goroutines could both load the same value before either increments it, resulting in duplicate counter values.
   
   The correct implementation should atomically fetch-and-increment the value before yielding it. This ensures each caller gets a unique, sequential counter value even in concurrent scenarios.



##########
table/rolling_data_writer.go:
##########
@@ -60,6 +66,8 @@ func NewWriterFactory(rootLocation string, args recordWritingArgs, meta *Metadat
 // file strategy to manage file sizes.
 type RollingDataWriter struct {
 	partitionKey    string
+	partitionID     int          // Added: unique ID for this partition
+	fileCount       atomic.Int64 // Added: counter for files in this partition

Review Comment:
   The "Added:" prefix in comments is typically used temporarily during code reviews but should be removed before merging to production. Standard Go documentation comments should describe what the field does, not that it was recently added. Consider updating these comments to describe the purpose of each field instead.



##########
table/rolling_data_writer.go:
##########
@@ -33,25 +33,31 @@ import (
 // for different partitions, providing shared configuration and coordination
 // across all writers in a partitioned write operation.
 type writerFactory struct {
-	rootLocation   string
-	args           recordWritingArgs
-	meta           *MetadataBuilder
-	taskSchema     *iceberg.Schema
-	targetFileSize int64
-	writers        sync.Map
-	counter        atomic.Int64
-	mu             sync.Mutex
+	rootLocation       string
+	args               recordWritingArgs
+	meta               *MetadataBuilder
+	taskSchema         *iceberg.Schema
+	targetFileSize     int64
+	writers            sync.Map
+	nextCount          func() (int, bool)
+	stopCount          func()
+	partitionIDCounter atomic.Int64 // Added: counter for partition IDs

Review Comment:
   The "Added:" prefix in comments is typically used temporarily during code reviews but should be removed before merging to production. Standard Go documentation comments should describe what the field does, not that it was recently added. Consider updating this comment to describe the purpose of the field instead.
   ```suggestion
   	partitionIDCounter atomic.Int64 // partitionIDCounter generates unique IDs for partitions
   ```



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "ferhatelmas (via GitHub)" <gi...@apache.org>.
ferhatelmas commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737450124


##########
table/writer_test.go:
##########
@@ -0,0 +1,156 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package table
+
+import (
+	"testing"
+
+	"github.com/google/uuid"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+)
+
+func TestGenerateDataFileName(t *testing.T) {
+	tests := []struct {

Review Comment:
   worth of adding a test with partition id and file count more than 5 digits?



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737892863


##########
table/writer_test.go:
##########
@@ -0,0 +1,156 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package table
+
+import (
+	"testing"
+
+	"github.com/google/uuid"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+)
+
+func TestGenerateDataFileName(t *testing.T) {
+	tests := []struct {

Review Comment:
   I don't think there's necessarily much worth to it, but it's also a pretty low cost addition so I'll add it



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "ferhatelmas (via GitHub)" <gi...@apache.org>.
ferhatelmas commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737402562


##########
table/writer_test.go:
##########
@@ -0,0 +1,156 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package table
+
+import (
+	"testing"
+
+	"github.com/google/uuid"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+)
+
+func TestGenerateDataFileName(t *testing.T) {
+	tests := []struct {
+		name        string
+		task        WriteTask
+		extension   string
+		wantPattern string // regex pattern to match

Review Comment:
   this doesn't seem to be a regex, maybe just rename to `want` and drop the comment



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737869956


##########
table/writer_test.go:
##########
@@ -0,0 +1,156 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package table
+
+import (
+	"testing"
+
+	"github.com/google/uuid"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+)
+
+func TestGenerateDataFileName(t *testing.T) {
+	tests := []struct {
+		name        string
+		task        WriteTask
+		extension   string
+		wantPattern string // regex pattern to match

Review Comment:
   yea, that comment is from a previous version of this 



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "ferhatelmas (via GitHub)" <gi...@apache.org>.
ferhatelmas commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737358113


##########
table/rolling_data_writer.go:
##########
@@ -157,12 +162,15 @@ func (r *RollingDataWriter) flushToDataFile(batch []arrow.RecordBatch, outputDat
 
 	task := iter.Seq[WriteTask](func(yield func(WriteTask) bool) {
 		cnt := int(r.factory.counter.Add(1) - 1)
+		fileCount := int(r.fileCount.Add(1))
 
 		yield(WriteTask{
-			Uuid:    *r.factory.args.writeUUID,
-			ID:      cnt,
-			Schema:  r.factory.taskSchema,
-			Batches: batch,
+			Uuid:        *r.factory.args.writeUUID,
+			ID:          cnt,

Review Comment:
   nit: not exactly related to this PR but isn't `cnt` supposed to initialize by the given `args.counter` as in unpartitioned case? 



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "kevinjqliu (via GitHub)" <gi...@apache.org>.
kevinjqliu commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2740032484


##########
internal/utils.go:
##########
@@ -164,12 +165,15 @@ func RecoverError(err *error) {
 }
 
 func Counter(start int) iter.Seq[int] {
+	var current atomic.Int64
+	current.Store(int64(start))
+
 	return func(yield func(int) bool) {
 		for {
-			if !yield(start) {
+			if !yield(int(current.Load())) {
 				return
 			}
-			start++
+			current.Add(1)

Review Comment:
   this seems valid, @zeroshade wdyt?



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737757866


##########
table/rolling_data_writer.go:
##########
@@ -157,12 +162,15 @@ func (r *RollingDataWriter) flushToDataFile(batch []arrow.RecordBatch, outputDat
 
 	task := iter.Seq[WriteTask](func(yield func(WriteTask) bool) {
 		cnt := int(r.factory.counter.Add(1) - 1)
+		fileCount := int(r.fileCount.Add(1))
 
 		yield(WriteTask{
-			Uuid:    *r.factory.args.writeUUID,
-			ID:      cnt,
-			Schema:  r.factory.taskSchema,
-			Batches: batch,
+			Uuid:        *r.factory.args.writeUUID,
+			ID:          cnt,

Review Comment:
   that's a good point and worthwhile to fix in here.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "ferhatelmas (via GitHub)" <gi...@apache.org>.
ferhatelmas commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737378758


##########
table/arrow_utils.go:
##########
@@ -1338,13 +1338,17 @@ func recordsToDataFiles(ctx context.Context, rootLocation string, meta *Metadata
 		tasks := func(yield func(WriteTask) bool) {
 			defer stopCount()
 
+			fileCount := 0
 			for batch := range binPackRecords(args.itr, 20, targetFileSize) {
 				cnt, _ := nextCount()
+				fileCount++
 				t := WriteTask{
-					Uuid:    *args.writeUUID,
-					ID:      cnt,
-					Schema:  taskSchema,
-					Batches: batch,
+					Uuid:        *args.writeUUID,
+					ID:          cnt,
+					PartitionID: 0, // unpartitioned tables use 0

Review Comment:
   does it make sense to use unpartitioned spec id directly? 



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #702:
URL: https://github.com/apache/iceberg-go/pull/702


-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2771234001


##########
table/rolling_data_writer.go:
##########
@@ -156,13 +166,16 @@ func (r *RollingDataWriter) flushToDataFile(batch []arrow.RecordBatch, outputDat
 	}
 
 	task := iter.Seq[WriteTask](func(yield func(WriteTask) bool) {
-		cnt := int(r.factory.counter.Add(1) - 1)
+		cnt, _ := r.factory.nextCount()

Review Comment:
   we made sure the base counter is safe for concurrent use, so I think this should be fine as long as we make sure that `args.counter` is defined as having to be safe for concurrent use.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "ferhatelmas (via GitHub)" <gi...@apache.org>.
ferhatelmas commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737371622


##########
table/writer.go:
##########
@@ -33,15 +33,18 @@ import (
 type WriteTask struct {
 	Uuid        uuid.UUID
 	ID          int
+	PartitionID int // Added: partition ID for file naming
+	FileCount   int // Added: file counter within this task
 	Schema      *iceberg.Schema
 	Batches     []arrow.RecordBatch
 	SortOrderID int
 }
 
 func (w WriteTask) GenerateDataFileName(extension string) string {
 	// Mimics the behavior in the Java API:
-	// https://github.com/apache/iceberg/blob/a582968975dd30ff4917fbbe999f1be903efac02/core/src/main/java/org/apache/iceberg/io/OutputFileFactory.java#L92-L101
-	return fmt.Sprintf("00000-%d-%s.%s", w.ID, w.Uuid, extension)
+	// https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/io/OutputFileFactory.java

Review Comment:
   IMO [permalink](https://github.com/apache/iceberg/blob/03ed4ba9af4e47d32bdb22b7e3d033eb2a4b2c83/core/src/main/java/org/apache/iceberg/io/OutputFileFactory.java#L93-L103) was better if file or line changes



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] fix(table): use proper data file names [iceberg-go]

Posted by "ferhatelmas (via GitHub)" <gi...@apache.org>.
ferhatelmas commented on code in PR #702:
URL: https://github.com/apache/iceberg-go/pull/702#discussion_r2737391851


##########
table/arrow_utils.go:
##########
@@ -1338,13 +1338,17 @@ func recordsToDataFiles(ctx context.Context, rootLocation string, meta *Metadata
 		tasks := func(yield func(WriteTask) bool) {
 			defer stopCount()
 
+			fileCount := 0
 			for batch := range binPackRecords(args.itr, 20, targetFileSize) {

Review Comment:
   aside, 20 seems like the default used in multiple locations, might benefit from putting it into a constant 



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org