Skip to content

feat(arrow): pass &FieldRef instead of &Field in ArrowSchemaVisitor to achieve cheap clone - #2471

Merged
blackmwk merged 4 commits into
apache:mainfrom
TwinklerG:twinklerg/arrow-schema-vistor-pass-fieldref
May 26, 2026
Merged

blackmwk merged 4 commits into
apache:mainfrom
TwinklerG:twinklerg/arrow-schema-vistor-pass-fieldref

Conversation

@TwinklerG

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

What changes are included in this PR?

Trait ArrowSchemaVisitor accepts &FieldRef instead of &Field.

Correspondingly, struct that implements this trait has also changed, such as Int96CoercionVisitor, ArrowSchemaConverter and MetadataStripVisitor.

All changes happen in crates/iceberg/src/arrow/schema.rs and crates/iceberg/src/arrow/int96.rs

Are these changes tested?

Yes.

@TwinklerG
TwinklerG force-pushed the twinklerg/arrow-schema-vistor-pass-fieldref branch from 14d5e2d to c43e6d8 Compare May 20, 2026 09:02
@TwinklerG TwinklerG changed the title feat(arrow): pass FieldRef instead of &Field in ArrowSchemaVisitor to achieve cheap clone feat(arrow): pass &FieldRef instead of &Field in ArrowSchemaVisitor to achieve cheap clone May 20, 2026

@mbutrovich mbutrovich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @TwinklerG! I think this is exactly what I had in mind when I opened the issue.

One suggestion before merge: now that the ArrowSchemaVisitor trait surface speaks &FieldRef, the two private helpers consumed by visitor-method bodies are the lone &Field outliers. Aligning them keeps the visitor surface internally consistent and means future helpers/state don't have to re-litigate the choice.

Thanks again!

Comment thread crates/iceberg/src/arrow/int96.rs Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See review body, I think this should be &FieldRef to align.

Comment thread crates/iceberg/src/arrow/schema.rs Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

See review body, I think this should be &FieldRef to align.

@TwinklerG

TwinklerG commented May 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Thank @mbutrovich for the feedback! I've updated the private helper functions to use &FieldRef as well to keep the internal implementation consistent. Ready for another look!

@mbutrovich mbutrovich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks @TwinklerG!

@blackmwk blackmwk 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.

Thanks @TwinklerG for this fix!

@blackmwk
blackmwk merged commit 023f4ea into apache:main May 26, 2026
21 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.

ArrowSchemaVisitor should pass FieldRef instead of &Field

4 participants