Skip to content

Commit

Permalink
review & nits
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiantia committed Feb 19, 2025
1 parent 57d4dc7 commit 038d3e7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions kernel/src/scan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ pub(crate) mod test_utils {
) -> Box<ArrowEngineData> {
let handler = SyncJsonHandler {};

let json_strings = paths
let mut json_strings: Vec<String> = paths
.iter()
.map(|path| {
Expand Down
8 changes: 6 additions & 2 deletions kernel/src/table_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ mod test {
let protocol = Protocol::try_new(
3,
7,
Some([ReaderFeatures::UnsupportedFeature]),
Some([WriterFeatures::UnsupportedFeature]),
Some([ReaderFeatures::UnrecognizedReaderFeature(
"unrecognizedReaderFeature".to_string(),
)]),
Some([WriterFeatures::UnrecognizedWriterFeature(
"unrecognizedWriterFeature".to_string(),
)]),
)
.unwrap();
let table_root = Url::try_from("file:///").unwrap();
Expand Down
14 changes: 8 additions & 6 deletions kernel/src/table_features/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ pub enum ReaderFeatures {
/// protocol checks during VACUUM operations
VacuumProtocolCheck,
/// A dummy variant used to represent an unsupported feature for testing purposes
UnsupportedFeature,
#[cfg(test)]
UnrecognizedReaderFeature(String),
}

/// Similar to reader features, writer features communicate capabilities that must be implemented
Expand Down Expand Up @@ -112,7 +113,8 @@ pub enum WriterFeatures {
/// protocol checks during VACUUM operations
VacuumProtocolCheck,
/// A dummy variant used to represent an unsupported feature for testing purposes
UnsupportedFeature,
#[cfg(test)]
UnrecognizedWriterFeature(String),
}

impl From<ReaderFeatures> for String {
Expand Down Expand Up @@ -149,6 +151,7 @@ pub(crate) static SUPPORTED_WRITER_FEATURES: LazyLock<HashSet<WriterFeatures>> =
mod tests {
use super::*;

// TODO: Test the UnrecognizedReaderFeature variant
#[test]
fn test_roundtrip_reader_features() {
let cases = [
Expand All @@ -159,10 +162,9 @@ mod tests {
(ReaderFeatures::TypeWideningPreview, "typeWidening-preview"),
(ReaderFeatures::V2Checkpoint, "v2Checkpoint"),
(ReaderFeatures::VacuumProtocolCheck, "vacuumProtocolCheck"),
(ReaderFeatures::UnsupportedFeature, "unsupportedFeature"),
];

assert_eq!(ReaderFeatures::VARIANTS.len(), cases.len());
assert_eq!(ReaderFeatures::VARIANTS.len() - 1, cases.len());

for ((feature, expected), name) in cases.into_iter().zip(ReaderFeatures::VARIANTS) {
assert_eq!(*name, expected);
Expand All @@ -178,6 +180,7 @@ mod tests {
}
}

// TODO: Test the UnrecognizedWriterFeature variant
#[test]
fn test_roundtrip_writer_features() {
let cases = [
Expand All @@ -198,10 +201,9 @@ mod tests {
(WriterFeatures::IcebergCompatV1, "icebergCompatV1"),
(WriterFeatures::IcebergCompatV2, "icebergCompatV2"),
(WriterFeatures::VacuumProtocolCheck, "vacuumProtocolCheck"),
(WriterFeatures::UnsupportedFeature, "unsupportedFeature"),
];

assert_eq!(WriterFeatures::VARIANTS.len(), cases.len());
assert_eq!(WriterFeatures::VARIANTS.len() - 1, cases.len());

for ((feature, expected), name) in cases.into_iter().zip(WriterFeatures::VARIANTS) {
assert_eq!(*name, expected);
Expand Down
8 changes: 3 additions & 5 deletions kernel/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ pub(crate) mod test_utils {
use tempfile::TempDir;
use test_utils::delta_path_for_version;

use crate::{
actions::{Add, Cdc, CommitInfo, Metadata, Protocol, Remove},
engine::arrow_data::ArrowEngineData,
EngineData,
};
use crate::actions::{Add, Cdc, CommitInfo, Metadata, Protocol, Remove};
use crate::engine::arrow_data::ArrowEngineData;
use crate::EngineData;

#[derive(Serialize)]
pub(crate) enum Action {
Expand Down

0 comments on commit 038d3e7

Please sign in to comment.