NoahKusaba commented on code in PR #3303:
URL: https://github.com/apache/iceberg-rust/pull/3303#discussion_r4150559670
##########
crates/iceberg/src/arrow/schema.rs:
##########
@@ -1200,53 +1200,57 @@ impl MetadataStripVisitor {
field_stack: Vec::new(),
}
}
+
+ /// Stores a field's name and nullability, to rebuild it once its type has
+ /// been visited.
+ fn push_field(&mut self, field: &FieldRef) -> Result<()> {
Review Comment:
Upfront: the naming options below are an AI opinion (from Claude Code), not
my own pick yet. I'm posting them so we can choose one together.
The two steps are: record a field's name and nullability before its type is
visited, then build the field with the stripped type and no metadata
afterwards. A start/finish pair over "pending" fields describes that:
```rust
struct MetadataStripVisitor {
/// Fields whose types are still being visited, innermost last
pending_fields: Vec<PendingField>,
}
/// What `MetadataStripVisitor` keeps of a field until its type is visited
struct PendingField {
name: String,
nullable: bool,
}
/// Records a field whose type is about to be visited.
fn start_field(&mut self, field: &FieldRef) -> Result<()>
/// Builds the innermost pending field with `data_type` and no metadata.
fn finish_field(&mut self, data_type: DataType, kind: &str) -> Result<Field>
```
Other pairs that would also work:
| Before the type | After the type | Stack field |
|---|---|---|
| `enter_field` | `exit_field` | `open_fields` |
| `begin_field` | `end_field` | `open_fields` |
| `record_field` | `rebuild_field` | `pending_fields` |
Do any of these work for you, or would you prefer something else?
--
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]