Skip to content

Commit 4101acc

Browse files
roeaprtyler
authored andcommitted
chore: enable dat testing with the existing code
prior to bringing kernel replay in, I would like "classic" delta-rs parsing Closes #863 Signed-off-by: R. Tyler Croy <[email protected]>
1 parent 7920ea3 commit 4101acc

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

crates/core/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ humantime = { version = "2.1.0" }
100100
[dev-dependencies]
101101
criterion = "0.5"
102102
ctor = "0"
103+
datatest-stable = "0.2"
103104
deltalake-test = { path = "../test", features = ["datafusion"] }
104105
dotenvy = "0"
105106
fs_extra = "1.2.0"
@@ -134,3 +135,7 @@ cloud = ["object_store/cloud"]
134135

135136
# enable caching some file I/O operations when scanning delta logs
136137
delta-cache = ["foyer", "tempfile", "url/serde"]
138+
139+
[[test]]
140+
name = "dat"
141+
harness = false

crates/core/tests/dat.rs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
use std::path::Path;
2+
3+
use deltalake_core::DeltaTableBuilder;
4+
use deltalake_test::acceptance::read_dat_case;
5+
6+
static SKIPPED_TESTS: &[&str; 4] = &[
7+
"iceberg_compat_v1",
8+
"column_mapping",
9+
"check_constraints",
10+
"deletion_vectors",
11+
];
12+
13+
fn reader_test_eager(path: &Path) -> datatest_stable::Result<()> {
14+
let root_dir = format!(
15+
"{}/{}",
16+
env!["CARGO_MANIFEST_DIR"],
17+
path.parent().unwrap().to_str().unwrap()
18+
);
19+
for skipped in SKIPPED_TESTS {
20+
if root_dir.ends_with(skipped) {
21+
println!("Skipping test: {}", skipped);
22+
return Ok(());
23+
}
24+
}
25+
26+
tokio::runtime::Builder::new_current_thread()
27+
.enable_all()
28+
.build()?
29+
.block_on(async {
30+
let case = read_dat_case(root_dir).unwrap();
31+
32+
let table = DeltaTableBuilder::from_uri(case.table_root().unwrap())
33+
.load()
34+
.await
35+
.expect("table");
36+
let table_info = case.table_summary().expect("load summary");
37+
let snapshot = table.snapshot().expect("Failed to load snapshot");
38+
let protocol = table.protocol().expect("Failed to load protocol");
39+
assert_eq!(snapshot.version() as u64, table_info.version);
40+
assert_eq!(
41+
(protocol.min_reader_version, protocol.min_writer_version),
42+
(table_info.min_reader_version, table_info.min_writer_version)
43+
);
44+
});
45+
Ok(())
46+
}
47+
48+
datatest_stable::harness!(
49+
reader_test_eager,
50+
"../../dat/v0.0.3/reader_tests/generated/",
51+
r"test_case_info\.json"
52+
);

0 commit comments

Comments
 (0)