xanderbailey commented on code in PR #2997:
URL: https://github.com/apache/iceberg-rust/pull/2997#discussion_r3841900525
##########
crates/iceberg/src/scan/mod.rs:
##########
@@ -42,14 +44,172 @@ use crate::metadata_columns::{
};
use crate::partitioning::compute_unified_partition_type;
use crate::runtime::Runtime;
-use crate::spec::{DEFAULT_SCHEMA_NAME_MAPPING, DataContentType, NameMapping,
SnapshotRef};
+use crate::spec::{
+ DEFAULT_SCHEMA_NAME_MAPPING, DataContentType, NameMapping, SchemaRef,
SnapshotRef,
+};
use crate::table::Table;
use crate::util::available_parallelism;
use crate::{Error, ErrorKind, Result};
/// A stream of arrow [`RecordBatch`]es.
pub type ArrowRecordBatchStream = BoxStream<'static, Result<RecordBatch>>;
+/// Shared configuration extracted from scan builders, used by both
+/// [`TableScanBuilder`] and [`IncrementalAppendScanBuilder`].
+pub(crate) struct ScanConfig<'a> {
+ table: &'a Table,
+ column_names: Option<Vec<String>>,
+ batch_size: Option<usize>,
+ case_sensitive: bool,
+ filter: Option<Predicate>,
+ concurrency_limit_data_files: usize,
+ concurrency_limit_manifest_entries: usize,
+ concurrency_limit_manifest_files: usize,
+ row_group_filtering_enabled: bool,
+ row_selection_enabled: bool,
+ /// Schema to project the scan onto. A standard scan passes the snapshot's
+ /// own schema (the correct behavior for time-travel scans). An incremental
+ /// scan passes the table's current schema so that rows written under an
+ /// older schema in the range are projected onto it (newer columns become
+ /// `NULL`), matching the Java and PyIceberg implementations.
+ schema: SchemaRef,
+}
+
+/// Shared build logic: validates columns, resolves field IDs, binds
predicates,
+/// and constructs [`PlanContext`] + [`TableScan`].
+pub(crate) fn build_table_scan(
+ config: ScanConfig<'_>,
+ snapshot: SnapshotRef,
+ manifest_file_filter: Option<ManifestFileFilter>,
+ manifest_entry_filter: Option<ManifestEntryFilter>,
+) -> Result<TableScan> {
+ let schema = config.schema.clone();
+
+ // Check that all column names exist in the schema (skip reserved columns).
Review Comment:
https://github.com/apache/iceberg-rust/pull/3059 fixes on main
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]