strip_metadata_from_schema fails on list and map columns
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- data-engineering
Research direction
Start at iceberg::arrow::strip_metadata_from_schema and inspect MetadataStripVisitor, especially the list and map visitor hooks. Run the provided nested-list reproduction and review the existing doctest. Done means list elements and map keys and values are handled without stack-underflow errors and metadata is removed at every level.
Written by the indexing model from the issue text.
Description
Apache Iceberg Rust version
main (8cb2adedd), 0.10.1
Describe the bug
iceberg::arrow::strip_metadata_from_schema returns an error for any Arrow schema that contains a list or map column:
Unexpected => Field stack underflow in list
MetadataStripVisitor remembers each field's name and nullability by pushing onto field_stack in before_field, and pops it when rebuilding the field in list, map, struct and primitive. But visit_list and the map arm of visit_type call before_list_element, before_map_key and before_map_value for the inner fields, not before_field. The visitor doesn't override those hooks, so rebuilding a list element or a map key or value pops from an empty stack.
The only test of this function is the doctest, which uses a flat schema, so this wasn't caught.
Downstream, datafusion-iceberg calls this function to validate INSERTs into partitioned tables, so an INSERT into a partitioned table with a list or map column fails (found in apache/datafusion-iceberg#19).
To Reproduce
use std::sync::Arc;
use arrow_schema::{DataType, Field, Schema};
use iceberg::arrow::strip_metadata_from_schema;
let schema = Schema::new(vec![Field::new(
"l",
DataType::List(Arc::new(Field::new("element", DataType::Int32, true))),
true,
)]);
strip_metadata_from_schema(&schema).unwrap(); // Field stack underflow in list
Expected behavior
It returns the same schema with metadata removed at every level, including list elements and map keys and values.
Willingness to contribute
I can contribute a fix for this bug independently
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 574
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 70
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/iceberg-rust
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/iceberg-rust#3285 · 1 reaction ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/iceberg-rust#3280 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/iceberg-rust#3234 · 2 reactions ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/iceberg-rust#3229 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/iceberg-rust#3222 · 1 comment ·
Maintainers usually reply within 1 day
All issues in apache/iceberg-rust
Similar issues
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
stackabletech/kafka-operator#1033 · 1 comment ·
Maintainers usually reply within 1 day
-
bug good first issue needs testing
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
farion1231/cc-switch#7744 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
vercel-labs/agent-browser#2017 ·
Maintainers usually reply within 1 day