Skip to content

fix(table): use proper data file names - #702

Merged
zeroshade merged 6 commits into
apache:mainfrom
zeroshade:data-file-names
Feb 5, 2026
Merged

zeroshade merged 6 commits into
apache:mainfrom
zeroshade:data-file-names

Conversation

@zeroshade

Copy link
Copy Markdown
Member

fixes #697

Follows the same standard as the java implementation to generate data file names appropriately.

Adds a test to confirm the name generation.

Comment thread table/rolling_data_writer.go Resolved
Comment thread table/writer.go Resolved
Comment thread table/arrow_utils.go Resolved
Comment thread table/arrow_utils.go Resolved
Comment thread table/writer_test.go Resolved
Comment thread table/writer_test.go Resolved
@zeroshade
zeroshade requested review from Fokko and kevinjqliu January 28, 2026 18:27

Copilot AI 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.

Pull request overview

This pull request fixes data file naming to properly track partition IDs and file counts instead of using hardcoded "00000" values. The implementation follows the Java Iceberg reference to generate spec-compliant file names with the format {partitionId:05d}-{taskId}-{operationId}-{fileCount:05d}.{extension}.

Changes:

  • Updated WriteTask struct to include PartitionID and FileCount fields for proper file naming
  • Modified GenerateDataFileName to use the new fields in the correct format with proper padding
  • Added comprehensive unit tests for file name generation covering various scenarios

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
table/writer_test.go Added comprehensive unit tests for data file name generation with various partition and file count scenarios
table/writer.go Updated WriteTask struct with PartitionID and FileCount fields; modified GenerateDataFileName to use proper format string
table/rolling_data_writer.go Added partition ID counter to writerFactory and file counter to RollingDataWriter; updated WriteTask creation to populate new fields
table/arrow_utils.go Updated unpartitioned write path to use UnpartitionedSpec.ID() for PartitionID and track file count; extracted magic number to named constant
internal/utils.go Modified Counter function to use atomic operations for thread-safety (but has a race condition issue)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/utils.go Resolved
Comment thread table/rolling_data_writer.go Resolved
Comment thread table/writer.go Resolved
Comment thread table/rolling_data_writer.go Resolved
Comment thread table/rolling_data_writer.go Resolved
@zeroshade
zeroshade merged commit 293cbb8 into apache:main Feb 5, 2026
11 checks passed
rockwotj pushed a commit to rockwotj/iceberg-go that referenced this pull request Mar 18, 2026
fixes apache#697

Follows the same standard as the java implementation to generate data
file names appropriately.

Adds a test to confirm the name generation.

---------

Co-authored-by: Copilot <[email protected]>
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.

Data file names always use hardcoded "00000" partition ID instead of tracking actual sequence

4 participants