Skip to content

Commit

Permalink
feat: Support writing to not only 3/7 protocol (#693)
Browse files Browse the repository at this point in the history
Our previous write protocol check was too strict. Now we just ensure that the protocol makes sense given what features are present/specified.

Made all existing `write.rs` tests also write to a protocol 1/1 table, and they all work.
  • Loading branch information
nicklan authored Feb 20, 2025
1 parent 484eb33 commit e2bcd0b
Show file tree
Hide file tree
Showing 2 changed files with 429 additions and 376 deletions.
27 changes: 18 additions & 9 deletions kernel/src/actions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,26 @@ impl Protocol {
/// support the specified protocol writer version and all enabled writer features?
pub fn ensure_write_supported(&self) -> DeltaResult<()> {
match &self.writer_features {
// if min_reader_version = 3 and min_writer_version = 7 and all writer features are
// supported => OK
Some(writer_features)
if self.min_reader_version == 3 && self.min_writer_version == 7 =>
{
Some(writer_features) if self.min_writer_version == 7 => {
// if we're on version 7, make sure we support all the specified features
ensure_supported_features(writer_features, &SUPPORTED_WRITER_FEATURES)
}
// otherwise not supported
_ => Err(Error::unsupported(
"Only tables with min reader version 3 and min writer version 7 with no table features are supported."
)),
Some(_) => {
// there are features, but we're not on 7, so the protocol is actually broken
Err(Error::unsupported(
"Tables with min writer version != 7 should not have table features.",
))
}
None => {
// no features, we currently only support version 1 in this case
require!(
self.min_writer_version == 1,
Error::unsupported(
"Currently delta-kernel-rs can only write to tables with protocol.minWriterVersion = 1 or 7"
)
);
Ok(())
}
}
}
}
Expand Down
Loading

0 comments on commit e2bcd0b

Please sign in to comment.