Skip to content

refactor(spec)!: accept impl Into<Type> in NestedField constructors - #3527

Merged
CTTY merged 1 commit into
apache:mainfrom
dannycjones:refactor/nested-field-into-type
Oct 26, 2026
Merged

CTTY merged 1 commit into
apache:mainfrom
dannycjones:refactor/nested-field-into-type

Conversation

@dannycjones

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

No open issue for this one.

What changes are included in this PR?

This change introduces impl Into<Type> into NestedField constructors to improve ergonomics.

This is a breaking change to some callers who already called .into(). Those are updated. It is not worth going back and changing all callers. This will simplify benefit new callers (mainly tests).

Are these changes tested?

N/A

AI Disclosure

Used LLM to do the rewrite, it's very mechanical.

Co-authored-by: Danny C Jones <djonesoa@amazon.com>
Copilot AI balanced review requested due to automatic review settings October 24, 2026 18:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The mechanical conversion preserves constructor semantics, and the affected callers and public API snapshot consistently reflect the intended breaking change.

No open issues 🎉

What changed in this PR

Improves schema-construction ergonomics by accepting impl Into<Type> in NestedField and MapType constructors while preserving their behavior. This intentionally breaks type inference for callers that pass an unqualified .into() expression.

Changes:

  • Move type conversion into the constructors.
  • Update affected tests and fixtures to pass types directly.
  • Synchronize the public API snapshot with the new signatures.
File Description
crates/​iceberg/​src/​test_utils/​scan.rs Adapt scan fixtures to the new constructor signatures.
crates/​iceberg/​src/​spec/​partition.rs Update partition-test field construction.
crates/​iceberg/​src/​spec/​datatypes.rs Accept convertible types in field and map constructors.
crates/​iceberg/​src/​scan/​mod.rs Update scan-test schema construction.
crates/​iceberg/​src/​expr/​term.rs Update expression-test schema construction.
crates/​iceberg/​src/​avro/​schema.rs Adapt Avro schema tests, including nested types.
crates/​iceberg/​public-api.txt Record the updated public constructor signatures.

Review effort: Balanced

@dannycjones

Copy link
Copy Markdown
Contributor Author

@blackmwk @CTTY I am hoping to make tests a bit easier to read and write. WDYT?

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

Love this change, thanks!

@CTTY
CTTY added this pull request to the merge queue Oct 26, 2026
Merged via the queue into apache:main with commit 081a36d Oct 26, 2026
25 checks passed
@dannycjones
dannycjones deleted the refactor/nested-field-into-type branch October 27, 2026 09:27
Perseus pushed a commit to Perseus/iceberg-rust that referenced this pull request Oct 30, 2026
Backport of apache#3424 (net diff of PR head 86e35d3
against its merge base beba39c), adapted to base 5b82ab9.

Adds TableScanBuilder::with_column_stats(names) and
FileScanTask::column_stats(). Tasks carry the data file's column sizes,
value/null/NaN counts and lower/upper bounds only for the named
primitive columns. By default no statistics are kept and behaviour is
unchanged.

Upstream-PR: apache#3424
Upstream-head: 86e35d3
Backport-notes: scan/mod.rs conflicts resolved for the older base:
 resolve_field_id keeps its Option return (no apache#3070 ambiguity check),
 TableScanBuilder keeps snapshot_id (no apache#3260 snapshot_selection), and
 apache#3070's ambiguity tests are not carried. Datum::promote_to (apache#3483) is
 inlined as the same int->long / float->double widening in task.rs.
 Tests use Type::Primitive(..) (pre-apache#3527 NestedField signature) and
 test_utils imports SchemaRef. Details in DFD_FORK.md.
Needed-by: https://github.com/Perseus/datafusion-distributed/tree/iceberg-dyn-filter/f2-fork-column-stats
Remove-when: the pinned iceberg-rust rev contains apache#3424's merge commit
Issue: apache#3422
Perseus pushed a commit to Perseus/iceberg-rust that referenced this pull request Oct 31, 2026
Backport of apache#3424 (net diff of PR head 86e35d3
against its merge base beba39c), adapted to base 5b82ab9.

Adds TableScanBuilder::with_column_stats(names) and
FileScanTask::column_stats(). Tasks carry the data file's column sizes,
value/null/NaN counts and lower/upper bounds only for the named
primitive columns. By default no statistics are kept and behaviour is
unchanged.

Upstream-PR: apache#3424
Upstream-head: 86e35d3
Backport-notes: scan/mod.rs conflicts resolved for the older base:
 resolve_field_id keeps its Option return (no apache#3070 ambiguity check),
 TableScanBuilder keeps snapshot_id (no apache#3260 snapshot_selection), and
 apache#3070's ambiguity tests are not carried. Datum::promote_to (apache#3483) is
 inlined as the same int->long / float->double widening in task.rs.
 Tests use Type::Primitive(..) (pre-apache#3527 NestedField signature) and
 test_utils imports SchemaRef. Details in DFD_FORK.md.
Needed-by: https://github.com/Perseus/datafusion-distributed/tree/iceberg-dyn-filter/f2-fork-column-stats
Remove-when: the pinned iceberg-rust rev contains apache#3424's merge commit
Issue: apache#3422
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.

3 participants