Skip to content

refactor(scan): extract reusable scan functions - #3093

Open
xanderbailey wants to merge 3 commits into
apache:mainfrom
xanderbailey:codex/extract-scan-config
Open

refactor(scan): extract reusable scan functions#3093
xanderbailey wants to merge 3 commits into
apache:mainfrom
xanderbailey:codex/extract-scan-config

Conversation

@xanderbailey

@xanderbailey xanderbailey commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

What changes are included in this PR?

Extract the reusable calculations from TableScanBuilder::build into focused internal helpers for:

  • Resolving projected field IDs
  • Binding scan predicates
  • Reading the table name mapping
  • Computing the projected unified partition type

This is a behavior-preserving refactor. TableScanBuilder still resolves its snapshot and schema and explicitly constructs its PlanContext and TableScan. Snapshot semantics, manifest planning, and the public API are unchanged.

This change was extracted from #2997 so stable scan calculations can be reused without hiding the differences between standard and incremental scan planning.

Are these changes tested?

Refactor

AI Disclosure

Codex assisted with refactoring

@xanderbailey

xanderbailey commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Hopefully not controversial @blackmwk but means I can reuse this for append scans

@blackmwk

Copy link
Copy Markdown
Contributor

I don't think this is the right direction to go. For incremental scan, what's required should be extracting out utilies like unifying partition specs, rather than reusing such a config.

@xanderbailey
xanderbailey force-pushed the codex/extract-scan-config branch from 82c266b to f8bc7ec Compare August 28, 2026 10:59
@xanderbailey xanderbailey changed the title refactor(scan): extract shared scan config refactor(scan): extract scan planning utilities Aug 28, 2026
@xanderbailey xanderbailey changed the title refactor(scan): extract scan planning utilities refactor(scan): extract reusable scan functions Aug 28, 2026
@xanderbailey

Copy link
Copy Markdown
Contributor Author

Perhaps this is closer to what you're looking for @blackmwk

Comment thread crates/iceberg/src/scan/mod.rs Outdated
}
}

fn projected_field_ids(

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.

Suggested change
fn projected_field_ids(
fn collect_scan_field_ids(

Comment thread crates/iceberg/src/scan/mod.rs Outdated
.map(|predicate| predicate.map(Arc::new))
}

fn table_name_mapping(table: &Table) -> Result<Option<Arc<NameMapping>>> {

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.

This is no longer necessary, you should use the new TableProperties api

Comment thread crates/iceberg/src/scan/mod.rs Outdated
Comment on lines +153 to +161
compute_unified_partition_type(
table
.metadata()
.partition_specs_iter()
.map(|spec| spec.as_ref()),
schema,
)
.map(Arc::new)
.map(Some)

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.

I perfer to make this part of Table.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since it's a metadata only operation, I moved it to TableMetadata rather than Table, hope that works?

…nfig

# Conflicts:
#	crates/iceberg/public-api.txt
#	crates/iceberg/src/spec/table_metadata.rs
#	crates/iceberg/src/spec/table_properties.rs
@xanderbailey
xanderbailey requested a review from blackmwk August 28, 2026 12:40
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.

2 participants