Repository navigation
ci: Fix version for apache/skywalking-eyes/header - #4
Merged
Merged
Conversation
Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
Signed-off-by: Xuanwo <[email protected]>
Fokko
approved these changes
Jul 21, 2023
hareshkh
pushed a commit
to hareshkh/iceberg-rust
that referenced
this pull request
Feb 17, 2026
unfuck autorelease
This was referenced Jul 10, 2026
Closed
blackmwk
pushed a commit
that referenced
this pull request
Jul 13, 2026
…ault (#2797) ## Which issue does this PR close? - Closes #2795. ## What changes are included in this PR? When a projected field is not present in a data file, `RecordBatchTransformer` resolves it using the spec's Column Projection fallback rules. For a field with no `initial-default` it produced a null column (rule #4) unconditionally. That is correct only for optional fields. Per the spec's Default values section, null is a valid default only for an optional field: > If either default is not set for an optional field, then the default value is null for compatibility with older spec versions. So a required field that is absent from a data file with no `initial-default` has no valid value, and producing a null column for it violates the field's required (non-nullable) constraint. Previously this surfaced later as a confusing Arrow error (`Column '<name>' is declared as non-nullable but contains null values`) instead of a clear one. This PR adds the required-field case to the "not present" fallback in `record_batch_transformer.rs`: if a field is absent from the data file, has no `initial-default`, and is required, return `Missing required field: <name>`. The resolution order now mirrors Iceberg-Java's Parquet readers (`BaseParquetReaders` / `SparkParquetReaders.defaultReader`): file value, then `initial-default`, then null if optional, otherwise error. ## Are these changes tested? Yes, a unit test in `record_batch_transformer.rs`. Together with the existing `test_all_four_spec_rules` and `schema_evolution_adds_date_column_with_nulls`, all combinations of a field absent from the data file are covered: - absent + has `initial-default` returns the default value (rule #3) - existing `test_all_four_spec_rules`. - absent + optional + no default returns null (rule #4) - existing `test_all_four_spec_rules` and `schema_evolution_adds_date_column_with_nulls`. - absent + required + no default now errors with `Missing required field: <name>` - new `schema_evolution_required_field_absent_without_default_errors`.
raghav-reglobe
added a commit
to raghav-reglobe/iceberg-rust
that referenced
this pull request
Aug 7, 2026
A struct column whose nested struct gained a field after data files were written could not be read back: the RecordBatchTransformer promoted the column via arrow_cast::cast, which requires equal struct field counts — its positional fallback zips the source children against the target fields and trips StructArray::try_new with "Incorrect number of arrays for StructArray fields". Worse, when an add and a drop left the counts EQUAL, the positional fallback silently coerced the dropped field's values into the added field (wrong data, no error). Promote now routes through adapt_column: struct-bearing types are adapted field-by-field — target children matched to source children by Parquet field id (name fallback when either side lacks one), matches adapted recursively (type promotion included), missing optional children null-padded, missing required children a "Missing required field" error (spec Column Projection rule apache#4 applies to nested fields the same as top-level ones). Recursion covers structs nested in lists, large lists and maps; everything non-nested falls through to cast unchanged. Pinned by four unit tests (add-only unequal counts, add+drop equal counts, required-missing error, struct-in-list) plus an #[ignore] real-file repro harness (EVO_PARQUET/EVO_SCHEMA_JSON env) that reads a pre-evolution parquet under its evolved schema. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: Raghvendra Singh <[email protected]>
dannycjones
added a commit
to dannycjones/iceberg-rust
that referenced
this pull request
Sep 17, 2026
A Parquet column the reader cannot read at the projected type was silently turned into NULLs by the field-ID projection path, without logging, warning, or erroring. `get_arrow_projection_mask_with_field_ids` collapsed three unrelated conditions into one sentinel -- absence from `column_map`: the Arrow field carries no `PARQUET:field_id`, the field id is absent from either schema, and `type_promotion_is_valid` rejects the file/projected type pair. The NULL-filling that follows, and `RecordBatchTransformer` downstream, then read that sentinel as exactly one thing: the column is not in the file. Conflating "the file does not contain this column" -- where NULL is spec-correct, per column-projection rule apache#4 -- with "the file contains this column but we cannot read its type" means a query returns NULLs where real values exist on disk. All four column-projection rules are scoped by their preamble to "field ids which are not present in a data file"; a present-but- unreadable column was never in scope for any of them. Since the `filter_leaves` closure cannot return `Err`, accumulate the type mismatches and fail once it returns, naming all of them; genuine not-present cases still return `false`. The comment above the projection loop now states the resulting invariant. Identity partition columns -------------------------- The worst case is an identity-partitioned column, covered by `test_identity_partition_column_unreadable_in_file_errors`. When the unreadable column was also an identity partition column, skipping the leaf made it look absent to `RecordBatchTransformer` -- whose `present_in_file` test consults the *projected* batch schema, not the file -- so rule apache#1 fired and the manifest's partition constant was served in place of the column. That was never correct: rule apache#1 is a rule about absent columns, for metadata-only Hive migrations where the partition value lives only in the directory path. It is also not reliably right even as a guess, since the constant matches the column's values only if the file agrees with its manifest, and the column we cannot decode is exactly the one we cannot check that against. The test's file deliberately disagrees with its partition metadata to pin this down: before this change the scan returned the constant `20240101` for both rows while the file held `20240102` and `20240103`. Failing the scan is the correct outcome, so no exemption is carved out for the partition-column case. The stale comment claiming partition metadata is authoritative over the file's own columns is corrected; the code has implemented the opposite since identity-partition reads were fixed, and the two disagreed. Error kind ---------- `FeatureUnsupported`, not `DataInvalid`: this fires whenever a pair is missing from `type_promotion_is_valid`'s allowlist, and that allowlist is narrower than the spec. Some pairs really are invalid data -- the spec forbids narrowing, so a `long` column under an `int` schema cannot come from a valid schema history -- but others are valid files this reader cannot yet interpret, such as a Parquet `Geometry` column that arrow-rs surfaces as `Binary`, or the v3 `date` -> `timestamp` promotion the allowlist omits. One error kind covers both, so prefer the one that does not tell users their valid files are corrupt. Position-fallback path: left as a marked follow-up -------------------------------------------------- `get_arrow_projection_mask_fallback` type-checks nothing, so the same harm still arrives by a different route on that path: the column is projected, reaches `ColumnSource::Promote`, and is cast with `safe: true`, which NULLs unrepresentable values row by row while representable ones pass through. `test_fallback_projection_silently_nulls_unrepresentable_values` pins the behaviour rather than leaving it undocumented -- a file `long` [30, 5000000000, -3] read as `int` yields [30, NULL, -3]. Applying `type_promotion_is_valid` here is not the fix, and an earlier revision of this commit that did so is reverted. That allowlist answers "is this a legal Iceberg promotion", which presumes an Iceberg-aware writer; files reaching this path have none, so their physical types diverge by construction. Measured: pre-screening turns a Hive `string` column (written as unannotated Parquet `binary`) and a `timestamptz` column (written as naive `Timestamp(us, None)`) from correct reads into hard scan failures. `test_fallback_projection_reads_diverging_physical_types` locks both files in as readable so the mistake is not repeated. A strict (`safe: false`) `Promote` cast is the promising direction: it permits every lossless cast and fails only on the values that would become NULL. Measured across the `iceberg` suite, it changes exactly one test -- the gap-pinning one above -- and nothing else. It is left out of this commit because it is a second behaviour change on a second path, and because the same cast is shared with the equality-delete loader, where the blast radius differs (wrong rows returned rather than missing values). Follow-ups are marked in code rather than left implicit, on `get_arrow_projection_mask_fallback` (no type check; positional misalignment undetectable), `build_field_id_set_and_map` (predicate-only columns bypass the type check entirely, since `collect_scan_field_ids` derives `project_field_ids` from selected column names alone), and `BasicDeleteFileLoader::evolve_schema` (delete keys lost to a cast silently match no row). Compatibility ------------- This is a behaviour change on the field-ID path: reads that silently NULL-fill today will error. Every case it changes is a case that returns wrong data today. `type_promotion_is_valid` permits only a short allowlist (`Int`->`Long`, `Float`->`Double`, widening `Decimal`, `Fixed(16)`->`Uuid`) with `_ => false` as its fallthrough, so the affected set is not narrow. Distinct from an unsupported *Arrow* type, which already errors earlier via `arrow_schema_to_schema`.
dannycjones
added a commit
to dannycjones/iceberg-rust
that referenced
this pull request
Sep 17, 2026
A Parquet column the reader cannot read at the projected type was silently turned into NULLs by the field-ID projection path, without logging, warning, or erroring. `get_arrow_projection_mask_with_field_ids` collapsed three unrelated conditions into one sentinel -- absence from `column_map`: the Arrow field carries no `PARQUET:field_id`, the field id is absent from either schema, and `type_promotion_is_valid` rejects the file/projected type pair. The NULL-filling that follows, and `RecordBatchTransformer` downstream, then read that sentinel as exactly one thing: the column is not in the file. Conflating "the file does not contain this column" -- where NULL is spec-correct, per column-projection rule apache#4 -- with "the file contains this column but we cannot read its type" means a query returns NULLs where real values exist on disk. All four column-projection rules are scoped by their preamble to "field ids which are not present in a data file"; a present-but- unreadable column was never in scope for any of them. Accumulate the type mismatches and fail once the `filter_leaves` closure has returned, naming all of them; genuine not-present cases still return `false`. The comment above the projection loop now states the resulting invariant. Reporting from inside the closure is possible -- arrow exposes `try_filter_leaves`, and `filter_leaves` is implemented in terms of it -- but accumulating is preferred on two counts. `try_filter_leaves` short-circuits on the first `Err`, so a file with several unreadable columns would name only one, and naming all of them is the point. Its closure also yields `Result<bool, ArrowError>`, and `ArrowError` converts to `ErrorKind::Unexpected` (`error.rs`), so returning `FeatureUnsupported` through it means wrapping in `ArrowError::ExternalError` and downcasting back out -- more machinery than a `Vec<String>`, and it degrades quietly to `Unexpected` if the round-trip is got wrong. Identity partition columns -------------------------- The worst case is an identity-partitioned column, covered by `test_identity_partition_column_unreadable_in_file_errors`. When the unreadable column was also an identity partition column, skipping the leaf made it look absent to `RecordBatchTransformer` -- whose `present_in_file` test consults the *projected* batch schema, not the file -- so rule apache#1 fired and the manifest's partition constant was served in place of the column. That was never correct: rule apache#1 is a rule about absent columns, for metadata-only Hive migrations where the partition value lives only in the directory path. It is also not reliably right even as a guess, since the constant matches the column's values only if the file agrees with its manifest, and the column we cannot decode is exactly the one we cannot check that against. The test's file deliberately disagrees with its partition metadata to pin this down: before this change the scan returned the constant `20240101` for both rows while the file held `20240102` and `20240103`. Failing the scan is the correct outcome, so no exemption is carved out for the partition-column case. The stale comment claiming partition metadata is authoritative over the file's own columns is corrected; the code has implemented the opposite since identity-partition reads were fixed, and the two disagreed. Error kind ---------- `FeatureUnsupported`, not `DataInvalid`: this fires whenever a pair is missing from `type_promotion_is_valid`'s allowlist, and that allowlist is narrower than the spec. Some pairs really are invalid data -- the spec forbids narrowing, so a `long` column under an `int` schema cannot come from a valid schema history -- but others are valid files this reader cannot yet interpret, such as a Parquet `Geometry` column that arrow-rs surfaces as `Binary`, or the v3 `date` -> `timestamp` promotion the allowlist omits. One error kind covers both, so prefer the one that does not tell users their valid files are corrupt. Position-fallback path: left as a marked follow-up -------------------------------------------------- `get_arrow_projection_mask_fallback` type-checks nothing, so the same harm still arrives by a different route on that path: the column is projected, reaches `ColumnSource::Promote`, and is cast with `safe: true`, which NULLs unrepresentable values row by row while representable ones pass through. `test_fallback_projection_silently_nulls_unrepresentable_values` pins the behaviour rather than leaving it undocumented -- a file `long` [30, 5000000000, -3] read as `int` yields [30, NULL, -3]. Applying `type_promotion_is_valid` here is not the fix, and an earlier revision of this commit that did so is reverted. That allowlist answers "is this a legal Iceberg promotion", which presumes an Iceberg-aware writer; files reaching this path have none, so their physical types diverge by construction. Measured: pre-screening turns a Hive `string` column (written as unannotated Parquet `binary`) and a `timestamptz` column (written as naive `Timestamp(us, None)`) from correct reads into hard scan failures. `test_fallback_projection_reads_diverging_physical_types` locks both files in as readable so the mistake is not repeated. A strict (`safe: false`) `Promote` cast is the promising direction: it permits every lossless cast and fails only on the values that would become NULL. Measured across the `iceberg` suite, it changes exactly one test -- the gap-pinning one above -- and nothing else. It is left out of this commit because it is a second behaviour change on a second path, and because the same cast is shared with the equality-delete loader, where the blast radius differs (wrong rows returned rather than missing values). Follow-ups are marked in code rather than left implicit, on `get_arrow_projection_mask_fallback` (no type check; positional misalignment undetectable), `build_field_id_set_and_map` (predicate-only columns bypass the type check entirely, since `collect_scan_field_ids` derives `project_field_ids` from selected column names alone), and `BasicDeleteFileLoader::evolve_schema` (delete keys lost to a cast silently match no row). Compatibility ------------- This is a behaviour change on the field-ID path: reads that silently NULL-fill today will error. Every case it changes is a case that returns wrong data today. `type_promotion_is_valid` permits only a short allowlist (`Int`->`Long`, `Float`->`Double`, widening `Decimal`, `Fixed(16)`->`Uuid`) with `_ => false` as its fallthrough, so the affected set is not narrow. Distinct from an unsupported *Arrow* type, which already errors earlier via `arrow_schema_to_schema`.
dannycjones
added a commit
to dannycjones/iceberg-rust
that referenced
this pull request
Sep 17, 2026
A Parquet column the reader cannot read at the projected type was silently turned into NULLs by the field-ID projection path, without logging, warning, or erroring. `get_arrow_projection_mask_with_field_ids` collapsed three unrelated conditions into one sentinel -- absence from `column_map`: the Arrow field carries no `PARQUET:field_id`, the field id is absent from either schema, and `type_promotion_is_valid` rejects the file/projected type pair. The NULL-filling that follows, and `RecordBatchTransformer` downstream, then read that sentinel as exactly one thing: the column is not in the file. Conflating "the file does not contain this column" -- where NULL is spec-correct, per column-projection rule apache#4 -- with "the file contains this column but we cannot read its type" means a query returns NULLs where real values exist on disk. All four column-projection rules are scoped by their preamble to "field ids which are not present in a data file"; a present-but- unreadable column was never in scope for any of them. Accumulate the type mismatches and fail once the `filter_leaves` closure has returned, naming all of them; genuine not-present cases still return `false`. The comment above the projection loop now states the resulting invariant. Reporting from inside the closure is possible -- arrow exposes `try_filter_leaves`, and `filter_leaves` is implemented in terms of it -- but accumulating is preferred on two counts. `try_filter_leaves` short-circuits on the first `Err`, so a file with several unreadable columns would name only one, and naming all of them is the point. Its closure also yields `Result<bool, ArrowError>`, and `ArrowError` converts to `ErrorKind::Unexpected` (`error.rs`), so returning `FeatureUnsupported` through it means wrapping in `ArrowError::ExternalError` and downcasting back out -- more machinery than a `Vec<String>`, and it degrades quietly to `Unexpected` if the round-trip is got wrong. Identity partition columns -------------------------- The worst case is an identity-partitioned column, covered by `test_identity_partition_column_unreadable_in_file_errors`. When the unreadable column was also an identity partition column, skipping the leaf made it look absent to `RecordBatchTransformer` -- whose `present_in_file` test consults the *projected* batch schema, not the file -- so rule apache#1 fired and the manifest's partition constant was served in place of the column. That was never correct: rule apache#1 is a rule about absent columns, for metadata-only Hive migrations where the partition value lives only in the directory path. It is also not reliably right even as a guess, since the constant matches the column's values only if the file agrees with its manifest, and the column we cannot decode is exactly the one we cannot check that against. The test's file deliberately disagrees with its partition metadata to pin this down: before this change the scan returned the constant `20240101` for both rows while the file held `20240102` and `20240103`. Failing the scan is the correct outcome, so no exemption is carved out for the partition-column case. The stale comment claiming partition metadata is authoritative over the file's own columns is corrected; the code has implemented the opposite since identity-partition reads were fixed, and the two disagreed. Error kind ---------- `FeatureUnsupported`, not `DataInvalid`: this fires whenever a pair is missing from `type_promotion_is_valid`'s allowlist, and that allowlist is narrower than the spec. Some pairs really are invalid data -- the spec forbids narrowing, so a `long` column under an `int` schema cannot come from a valid schema history -- but others are valid files this reader cannot yet interpret, such as a Parquet `Geometry` column that arrow-rs surfaces as `Binary`, or the v3 `date` -> `timestamp` promotion the allowlist omits. One error kind covers both, so prefer the one that does not tell users their valid files are corrupt. Position-fallback path: left as a marked follow-up -------------------------------------------------- `get_arrow_projection_mask_fallback` type-checks nothing, so the same harm still arrives by a different route on that path: the column is projected, reaches `ColumnSource::Promote`, and is cast with `safe: true`, which NULLs unrepresentable values row by row while representable ones pass through. `test_fallback_projection_silently_nulls_unrepresentable_values` pins the behaviour rather than leaving it undocumented -- a file `long` [30, 5000000000, -3] read as `int` yields [30, NULL, -3]. Applying `type_promotion_is_valid` here is not the fix, and an earlier revision of this commit that did so is reverted. That allowlist answers "is this a legal Iceberg promotion", which presumes an Iceberg-aware writer; files reaching this path have none, so their physical types diverge by construction. Measured: pre-screening turns a Hive `string` column (written as unannotated Parquet `binary`) and a `timestamptz` column (written as naive `Timestamp(us, None)`) from correct reads into hard scan failures. `test_fallback_projection_reads_diverging_physical_types` locks both files in as readable so the mistake is not repeated. A strict (`safe: false`) `Promote` cast is the promising direction: it permits every lossless cast and fails only on the values that would become NULL. Measured across the `iceberg` suite, it changes exactly one test -- the gap-pinning one above -- and nothing else. It is left out of this commit because it is a second behaviour change on a second path, and because the same cast is shared with the equality-delete loader, where the blast radius differs (wrong rows returned rather than missing values). Remaining follow-ups are marked in code rather than left implicit, on `get_arrow_projection_mask_fallback` (no type check; positional misalignment undetectable), `try_cast_literal` in `predicate_visitor.rs` (see below), and `BasicDeleteFileLoader::evolve_schema` (delete keys lost to a cast silently match no row). Filter columns -------------- The type check covered projected columns only, and the projected set is not a superset of the filtered set: `collect_scan_field_ids` derives `project_field_ids` from the selected column names alone. So `select(["name"]).filter(v < 100)` checked `name` and nothing else, while the row filter went on to read `v` from the file regardless. Measured on one file with `v` physically `long` under an `int` schema: selecting `v` failed with `FeatureUnsupported`, while filtering on `v` without selecting it returned two rows, filtered against a value (5_000_000_000) the projected schema says cannot exist. `get_arrow_projection_mask` now takes the predicate's field ids alongside the projected ones. The union drives the pre-projection and the type check; the returned mask is still built from the projected ids alone, so a filter-only column is validated without being read into the output batch -- the row filter reads it through its own mask, as before. `test_predicate_only_column_is_type_checked` asserts both directions of the pair so they cannot drift apart again. Separately, and not fixed here: `try_cast_literal` casts the predicate literal down to the file column's type with `safe: true`, so an out-of-range literal becomes NULL and every comparison against it is NULL -- the scan silently returns zero rows. This is reachable on a spec-legal promotion, so it is not a consequence of an unreadable type: widen an `int` column to `long`, leave older files physically `int`, and `v < 5000000000` returns 0 rows instead of all of them. Measured, and noted on the function with the two candidate fixes. It is out of scope here because it is a bug in literal handling rather than in column-presence resolution, and it needs its own tests. Compatibility ------------- This is a behaviour change on the field-ID path: reads that silently NULL-fill today will error, and scans that filter on a column at an unreadable type will error where they previously returned rows. Every case it changes is a case that returns wrong data today. `type_promotion_is_valid` permits only a short allowlist (`Int`->`Long`, `Float`->`Double`, widening `Decimal`, `Fixed(16)`->`Uuid`) with `_ => false` as its fallthrough, so the affected set is not narrow. Distinct from an unsupported *Arrow* type, which already errors earlier via `arrow_schema_to_schema`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.