You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
StructType modification method and stat_transform schema boilerplate code refactor. (delta-io#1872)
## What changes are proposed in this pull request?
Closesdelta-io#1657
Currently, there is no Schema modification method supporting
insert/remove/replace a field from the Schema. Schema modification is
left to the caller to construct, which create the boilerplate code
across the codebase. This PR introduced the schema modification method
for inserting, removing and replacing a field from schema. In addition,
the schema modification method is integrated into the stats_transform to
reduce boilerplate code when creating schema.
Change included:
- New StructType method for schema modification :
- `pub fn with_field_inserted_after(mut self, after: Option<&str>,
new_field: StructField) -> Self`
- `pub fn with_field_removed(mut self, name: &str) -> Self`
- `pub fn with_field_replaced(mut self, name: &str, new_field:
StructField)`
- `pub fn with_field_inserted_after(mut self, before: Option<&str>,
new_field: StructField) -> Self`
- Unit-test for StructType to verify the correct behaviour of the schema
modification method `schema::tests::test_with_field_`
- Update the stats_transform.rs function `transform_add_schema`,
`build_add_output_schema`, `add_stats_parsed_to_add_schema`
## How was this change tested?
- Unit test for Schema modification method: `cargo test --package
delta_kernel --lib -- schema::tests::test_with_field_`
- Unit test for stat_transform `cargo test --package delta_kernel --lib
-- checkpoint::stats_transform::test`
---------
Co-authored-by: Nick Lanham <nicklan@users.noreply.github.com>
0 commit comments