Skip to content

feat(cmd/iceberg): add support for writing to branches(snapshot producer)#774

Open
subkanthi wants to merge 8 commits intoapache:mainfrom
subkanthi:add_branch_support_snapshot_write
Open

feat(cmd/iceberg): add support for writing to branches(snapshot producer)#774
subkanthi wants to merge 8 commits intoapache:mainfrom
subkanthi:add_branch_support_snapshot_write

Conversation

@subkanthi
Copy link
Contributor

@subkanthi subkanthi commented Mar 9, 2026

closes: #714

@subkanthi subkanthi marked this pull request as ready for review March 14, 2026 22:46
@zeroshade zeroshade changed the title Add support for writing to branches(snapshot producer) feat(cmd/iceberg): add support for writing to branches(snapshot producer) Mar 16, 2026
Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

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

Generally looks good, but I think we can improve the WriteOptions setup you've added. See below

Comment on lines +868 to +873
// WithOverwriteBranch sets the target branch for the overwrite. Default is main.
func WithOverwriteBranch(branch string) OverwriteOption {
return func(op *overwriteOperation) {
op.branch = branch
}
}
Copy link
Member

Choose a reason for hiding this comment

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

why do we need separate types for OverwriteOption and WriteOption? Can't we reuse the same option type?

}

func (t *Transaction) AddFiles(ctx context.Context, files []string, snapshotProps iceberg.Properties, ignoreDuplicates bool) error {
func (t *Transaction) AddFiles(ctx context.Context, files []string, snapshotProps iceberg.Properties, ignoreDuplicates bool, opts ...WriteOpt) error {
Copy link
Member

Choose a reason for hiding this comment

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

should more of these parameters get added as Options instead if we're going to go down this road? We should make all non-required parameters into options then

Comment on lines +63 to +73
func resolveBranch(opts []WriteOpt) string {
var o writeOpts
for _, opt := range opts {
opt.applyWriteOpt(&o)
}
if o.branch == "" {
return MainBranch
}

return o.branch
}
Copy link
Member

Choose a reason for hiding this comment

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

instead of resolveBranch, we should have a common config struct and just apply all the options to it and then we grab the values by the properties directly. That would make this more reusable in general

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.

Support committing snapshots to branches other than main

2 participants