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

fix: convert last checkpoint json keys to camelCase #2889

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions crates/core/src/table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub mod state_arrow;

/// Metadata for a checkpoint file
#[derive(Serialize, Deserialize, Debug, Default, Clone, Copy)]
#[serde(rename_all = "camelCase")]
pub struct CheckPoint {
/// Delta table version
pub(crate) version: i64, // 20 digits decimals
Expand Down Expand Up @@ -626,4 +627,21 @@ mod tests {
.unwrap();
(dt, tmp_dir)
}

#[test]
fn checkpoint_should_serialize_in_camel_case() {
let checkpoint = CheckPoint {
version: 1,
size: 1,
parts: None,
size_in_bytes: Some(1),
num_of_add_files: Some(1),
};

let checkpoint_json_serialized =
serde_json::to_string(&checkpoint).expect("could not serialize to json");

assert!(checkpoint_json_serialized.contains("sizeInBytes"));
assert!(checkpoint_json_serialized.contains("numOfAddFiles"));
}
}
Loading