feat!: Add feature icebergCompatV3 and it's FeatureInfo#2475
feat!: Add feature icebergCompatV3 and it's FeatureInfo#2475dengsh12 merged 7 commits intodelta-io:mainfrom
icebergCompatV3 and it's FeatureInfo#2475Conversation
icebergCompatV3 and it's protocol level validation rules
icebergCompatV3 and it's protocol level validation rulesicebergCompatV3 to TableFeature
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2475 +/- ##
==========================================
+ Coverage 88.47% 88.54% +0.07%
==========================================
Files 178 178
Lines 58807 58861 +54
Branches 58807 58861 +54
==========================================
+ Hits 52028 52120 +92
+ Misses 4793 4754 -39
- Partials 1986 1987 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
icebergCompatV3 to TableFeatureicebergCompatV3 to TableFeature
icebergCompatV3 to TableFeatureicebergCompatV3 and it's FeatureInfo
scottsand-db
left a comment
There was a problem hiding this comment.
Looks great! minor comments
There was a problem hiding this comment.
Do we need this line here btw? Can we clean this up? Since Enabled already covers this?
There was a problem hiding this comment.
Good catch! Cleared existing repeated validations
| } | ||
| Ok(()) | ||
| }), | ||
| FeatureRequirement::NotSupported(TableFeature::DeletionVectors), |
There was a problem hiding this comment.
Requires V2 and V3 to be NOT supported
There was a problem hiding this comment.
Added(validate V2V3not enabled)
| } | ||
| Ok(()) | ||
| }), | ||
| FeatureRequirement::NotEnabled(TableFeature::IcebergCompatV1), |
There was a problem hiding this comment.
Also requires V3 to be not supported
There was a problem hiding this comment.
Added(validate V3not enabled)
| FeatureRequirement::Enabled(TableFeature::RowTracking), | ||
| // V1/V2 may remain in `writerFeatures` (supported) as long as they are not active -- | ||
| // hence `NotEnabled` rather than `NotSupported`. | ||
| FeatureRequirement::NotEnabled(TableFeature::IcebergCompatV1), |
There was a problem hiding this comment.
They can be supported? just not enabled? -- The protocol says Require that IcebergCompatV1 and IcebergCompatV2 are not active on the table --- so, unfortunately, we have 3 adjectives here -- supported, enabled, active.
Can you please work with Hao to clear this up?
There was a problem hiding this comment.
They can be supported? just not enabled?
According to other impls yes. And yeah the word active confused me a little...
Can you please work with Hao to clear this up?
Sure! Let me directly open a PR to change the word active to enabled
There was a problem hiding this comment.
Update from Hao: https://github.com/delta-io/delta/blob/master/PROTOCOL.md#active-features seems active is also a formal delta word
There was a problem hiding this comment.
I remember now: active == enabled. // sigh, wish the entire protocol was aligned on this
| /// explicitly. `name`/`id` modes need a column-mapping-annotated schema (otherwise | ||
| /// `TableConfiguration::try_new` rejects the metadata for missing per-field annotations); | ||
| /// this helper swaps the schema accordingly. | ||
| fn create_mock_table_config_with_cm( |
There was a problem hiding this comment.
Do we have existing create_mock_table functions? I see
- create_mock_table_config
- create_mock_table_config_with_version
- create_mock_table_config_with_cm
Can you please create an issue and add a TODO comment here? // TODO(#12345): Consolidate ...
Also -- can you please create an IcebergCompatV3 tracking issue? See #2393 as an example (you can ignore the migration guide)
| #[case::v3_rejects_v1( | ||
| TableFeature::IcebergCompatV3, | ||
| TableFeature::IcebergCompatV1, | ||
| "requires 'icebergCompatV1' to not be enabled" | ||
| )] | ||
| #[case::v3_rejects_v2( | ||
| TableFeature::IcebergCompatV3, | ||
| TableFeature::IcebergCompatV2, | ||
| "requires 'icebergCompatV2' to not be enabled" | ||
| )] |
There was a problem hiding this comment.
v3 rejects v1, v2 is also covered by another test: test_iceberg_compat_v3_feature_requirements, add the tests again here just to make test_iceberg_compat_mutual_exclusion looks more complete
| // Spec: <https://github.com/delta-io/delta/blob/master/protocol_rfcs/iceberg-compat-v3.md> | ||
| // | ||
| // TODO: Implement the write-side requirements for IcebergCompatV3. | ||
| // Note: unlike V1/V2, V3 intentionally permits DeletionVectors per the RFC -- no |
There was a problem hiding this comment.
this can be moved into the feature_requirements below IMO. also try and avoid -- usually looks like AI
There was a problem hiding this comment.
Moved and removed --
| FeatureRequirement::NotEnabled(TableFeature::IcebergCompatV2), | ||
| ], | ||
| kernel_support: KernelSupport::NotSupported, | ||
| enablement_check: EnablementCheck::EnabledIf(|props| { |
There was a problem hiding this comment.
Should these enablement checks also be double checking that the feature is supported? or is that implied?
There was a problem hiding this comment.
Enabled includes supported
/// Generic method to check if a feature is enabled.
///
/// A feature is enabled if:
/// 1. It is supported in the protocol
/// 2. The enablement check passes
#[internal_api]
pub(crate) fn is_feature_enabled(&self, feature: &TableFeature) -> bool {
if !self.is_feature_supported(feature) {
return false;
}
match feature.info().enablement_check {
EnablementCheck::AlwaysIfSupported => true,
EnablementCheck::EnabledIf(check_fn) => check_fn(&self.table_properties),
}
}
|
|
||
| /// Whether Iceberg compatibility V3 is enabled for this table. When enabled, Delta Lake | ||
| /// ensures compatibility with Apache Iceberg V3 table format. | ||
| pub enable_iceberg_compat_v3: Option<bool>, |
There was a problem hiding this comment.
nit: should these table props really be iceberg_compat_v3_enabled ? this is us asking questions about the existing table properties at a given snapshot, right? just food for thought for future clarity ..
There was a problem hiding this comment.
Took some thoughts. Currently similar properties use the pattern(e.g. enable_row_tracking) and feel like we can follow the existing pattern here. The property itself means "hey, please enable iceberg_compat_v3", but yes most cases we are querying them. Perhaps we can expose helpers like iceberg_compat_v3_enabled()->bool in future? E.g. for column mapping
/// Determine the column mapping mode for a table based on the [`Protocol`] and [`TableProperties`]
pub(crate) fn column_mapping_mode(
protocol: &Protocol,
table_properties: &TableProperties,
) -> ColumnMappingMode {
match (
table_properties.column_mapping_mode,
protocol.min_reader_version(),
) {
// NOTE: The table property is optional even when the feature is supported, and is allowed
// (but should be ignored) even when the feature is not supported. For details see
// https://github.com/delta-io/delta/blob/master/PROTOCOL.md#column-mapping
(Some(mode), 2) => mode,
(Some(mode), 3) if protocol.has_table_feature(&TableFeature::ColumnMapping) => mode,
_ => ColumnMappingMode::None,
}
}
Or maybe the TableProperties could keep the fields private and expose pub getters?
dff52db to
e1a4b55
Compare
…lta-io#2504) ## Stacked PR Use this [link](https://github.com/delta-io/delta-kernel-rs/pull/2504/files) to review incremental changes. - [stack/add-v3-feature](delta-io#2475) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/2475/files)] [MERGED] - [**stack/write-part-when-ice3**](delta-io#2504) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/2504/files)] - [stack/block-alter-table](delta-io#2505) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/2505/files/15d151f8b271a72cb421ccfa81cda7d5887d1b37..562605f3911acd99854efae7940deb9344e7ee55)] - [stack/write-nested-id](delta-io#2508) [[Files changed](https://github.com/delta-io/delta-kernel-rs/pull/2508/files/562605f3911acd99854efae7940deb9344e7ee55..766ace41c2176c546f533be4ff0d7a9aa24ae001)] --------- ## What changes are proposed in this pull request? Materialize partition values when icebergCompatV3 enabled. ## How was this change tested? 1. When `icebergCompatV3` enabled, partition columns are contained into `physical_write_schema` 2. When `icebergCompatV3` supported but not enabled, partition columns are not contained into `physical_write_schema` Note: other related cases(e.g. `MaterializePartitionColumns`) are already covered by existing tests so we are not adding tests here
🥞 Stacked PR
Use this link to review incremental changes.
Stacked PR
Use this link to review incremental changes.
What changes are proposed in this pull request?
Add
icebergCompatV3and it'sFeatureInfoHow was this change tested?
Tested happy/unhappy paths for
icebergCompatV3:icebergCompatV1/V2enabledicebergCompatV3enablement follows the corresponding table property