Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add check for whether appendOnly table feature is supported or enabled #664

Merged
merged 9 commits into from
Mar 11, 2025
20 changes: 20 additions & 0 deletions kernel/src/table_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,26 @@ impl TableConfiguration {
.enable_deletion_vectors
.unwrap_or(false)
}

/// Returns `true` if the table supports the appendOnly table feature. To support this feature:
/// - The table must have a writer version between 2 and 7 (inclusive)
/// - If the table is on writer version 7, it must have the [`WriterFeatures::AppendOnly`]
/// writer feature.
#[allow(unused)]
#[cfg_attr(feature = "developer-visibility", visibility::make(pub))]
pub(crate) fn is_append_only_supported(&self) -> bool {
let protocol = &self.protocol;
match protocol.min_writer_version() {
7 if protocol.has_writer_feature(&WriterFeatures::AppendOnly) => true,
version => (2..=6).contains(&version),
}
}

#[allow(unused)]
#[cfg_attr(feature = "developer-visibility", visibility::make(pub))]
pub(crate) fn is_append_only_enabled(&self) -> bool {
self.is_append_only_supported() && self.table_properties.append_only.unwrap_or(false)
}
}

#[cfg(test)]
Expand Down
Loading