Skip to content

Conversation

@murali-db
Copy link
Collaborator

@murali-db murali-db commented Nov 14, 2025

⚠️ REVIEW ORDER: This PR depends on #1480 and should be reviewed AFTER it.

This PR is stacked on #1480#1479#1478#1477. Once those merge, GitHub will automatically update to show only this PR's changes.


This is part 5 of 5 PRs that implement schema diffing for Delta Kernel Rust.

What's in this PR

Map tests covering:

  • Field changes within map values (added/removed/renamed fields)
  • Map value nullability changes (loosened/tightened)
  • Maps with struct keys and nested field changes
  • Deeply nested combinations of structs, arrays, and maps

Changes

  • Added MapType to test module imports
  • Added HashSet import for set operations in tests
  • Added map tests
  • Removed feature gate - feature now enabled
  • Kept #![allow(dead_code)] as API is not yet integrated with other modules

Feature Gating

This PR removes the feature gate introduced in PR #1477, fully enabling the schema diff functionality.

Related

This is the final PR in the series. Closes #1346.

🤖 Generated with Claude Code

Introduces core data structures for schema diffing:
- SchemaDiff, FieldChange, FieldUpdate types
- FieldChangeType enum for classifying changes
- SchemaDiffError for validation errors
- ColumnName::parent() helper method

This is part 1/5 of the schema diffing feature implementation.
The actual diffing algorithm will be added in PR 2.

Note: This PR includes a temporary stub for compute_schema_diff()
to allow basic tests to compile. The full implementation from the
original PR delta-io#1346 will be copied exactly in PR 2.

Related to delta-io#1346
@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 98.97260% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.70%. Comparing base (fe01172) to head (b2bb992).

Files with missing lines Patch % Lines
kernel/src/schema/diff.rs 98.97% 14 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1481      +/-   ##
==========================================
+ Coverage   84.84%   85.70%   +0.86%     
==========================================
  Files         120      121       +1     
  Lines       32103    34147    +2044     
  Branches    32103    34147    +2044     
==========================================
+ Hits        27238    29266    +2028     
- Misses       3542     3549       +7     
- Partials     1323     1332       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

murali-db and others added 7 commits November 14, 2025 13:48
Adds a comprehensive unit test that exercises the filtering logic by
manually constructing a SchemaDiff with both top-level and nested
field changes. This test verifies that the methods correctly filter
fields by path depth (length 1 vs length > 1).

The test improves code coverage for these methods from 0% to full
coverage of the filtering logic, addressing CI coverage requirements.
Adds complete diffing functionality for non-nested schemas:
- Field collection and ID-based matching
- Detection of adds, removes, renames, nullability changes
- Physical name validation for column mapping
- Breaking change classification
- Full type classification including arrays and maps
- Ancestor filtering for LCA reporting

Currently supports flat schemas (top-level fields only). The
collect_all_fields_with_paths() function has a commented-out
recursive call that will be enabled in PR 3 to support nested fields.

All other functions are copied exactly from the original PR delta-io#1346
(murali-db/schema-evol) with no logic changes.

This is part 2/5 of the schema diffing feature implementation.

Tests included (9 tests):
- test_identical_schemas
- test_change_count
- test_top_level_added_field
- test_added_required_field_is_breaking
- test_added_nullable_field_is_not_breaking
- test_physical_name_validation
- test_multiple_change_types
- test_multiple_with_breaking_change
- test_duplicate_field_id_error

Related to delta-io#1346
Adds a comprehensive unit test that exercises the filtering logic by
manually constructing a SchemaDiff with both top-level and nested
field changes. This test verifies that the methods correctly filter
fields by path depth (length 1 vs length > 1).

The test improves code coverage for these methods from 0% to full
coverage of the filtering logic, addressing CI coverage requirements.
Extends schema diffing to handle nested structures:
- Recursive field collection through struct hierarchies
- Ancestor filtering to report only LCA changes
- Type change classification for struct containers
- Support for arbitrarily deep nesting

Arrays and maps support coming in follow-up PRs.

This is part 3/5 of the schema diffing feature implementation.

Related to delta-io#1346

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Adds a comprehensive unit test that exercises the filtering logic by
manually constructing a SchemaDiff with both top-level and nested
field changes. This test verifies that the methods correctly filter
fields by path depth (length 1 vs length > 1).

The test improves code coverage for these methods from 0% to full
coverage of the filtering logic, addressing CI coverage requirements.
Adds 8 comprehensive array tests:
- Array element struct field changes
- Doubly nested array type changes
- Nested array nullability (loosened/tightened)
- Inner array nullability (loosened/tightened)
- Simple array nullability (loosened/tightened)

All array implementation code was already present from PR 2.
This PR only adds tests to verify array functionality.

This is part 4/5 of the schema diffing feature implementation.

Related to delta-io#1346

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Adds a comprehensive unit test that exercises the filtering logic by
manually constructing a SchemaDiff with both top-level and nested
field changes. This test verifies that the methods correctly filter
fields by path depth (length 1 vs length > 1).

The test improves code coverage for these methods from 0% to full
coverage of the filtering logic, addressing CI coverage requirements.
Completes the schema diffing implementation with map support:
- Map key and value type tracking and comparison
- Map value nullability change detection (loosened/tightened)
- Struct keys and values within maps
- Deeply nested scenarios mixing structs, arrays, and maps

This is the final PR in the series that enables the schema diff functionality.
The feature gate has been removed - implementation is now active.

Test additions:
- test_map_value_struct_field_changes
- test_map_nullability_loosened
- test_map_nullability_tightened
- test_map_with_struct_key
- test_cursed_deeply_nested_complex_types

Note: #![allow(dead_code)] is retained as the API is not yet integrated with other modules.

This is the final part (5/5) of the schema diffing feature implementation.

Related to delta-io#1346

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@murali-db murali-db force-pushed the murali-db/schema-diff-pr5 branch from 713b5d2 to b2bb992 Compare November 14, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant