Skip to content

Commit 27accd7

Browse files
committed
test: run some more dat tests
Signed-off-by: Robert Pack <[email protected]>
1 parent d26587f commit 27accd7

File tree

5 files changed

+125
-17
lines changed

5 files changed

+125
-17
lines changed

.github/actions/load_dat/action.yaml renamed to .github/actions/load-dat/action.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ runs:
1919
- name: load DAT
2020
shell: bash
2121
run: |
22-
rm -rf {{ inputs.target-directory }}
22+
rm -rf ${{ inputs.target-directory }}
2323
curl -OL https://github.com/delta-incubator/dat/releases/download/v${{ inputs.version }}/deltalake-dat-v${{ inputs.version }}.tar.gz
24-
mkdir -p {{ inputs.target-directory }}
25-
tar --no-same-permissions -xzf deltalake-dat-v${{ inputs.version }}.tar.gz --directory {{ inputs.target-directory }}
24+
mkdir -p ${{ inputs.target-directory }}
25+
tar --no-same-permissions -xzf deltalake-dat-v${{ inputs.version }}.tar.gz --directory ${{ inputs.target-directory }}
2626
rm deltalake-dat-v${{ inputs.version }}.tar.gz

.github/workflows/build.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions-rs/toolchain@v1
2121
with:
2222
profile: default
23-
toolchain: '1.81'
23+
toolchain: "1.81"
2424
override: true
2525

2626
- name: Format
@@ -42,7 +42,7 @@ jobs:
4242
uses: actions-rs/toolchain@v1
4343
with:
4444
profile: default
45-
toolchain: '1.81'
45+
toolchain: "1.81"
4646
override: true
4747

4848
- name: build and lint with clippy
@@ -79,9 +79,12 @@ jobs:
7979
uses: actions-rs/toolchain@v1
8080
with:
8181
profile: default
82-
toolchain: '1.81'
82+
toolchain: "1.81"
8383
override: true
8484

85+
- name: Load DAT data
86+
uses: ./.github/actions/load-dat
87+
8588
- name: Run tests
8689
run: cargo test --verbose --features ${{ env.DEFAULT_FEATURES }}
8790

@@ -114,7 +117,7 @@ jobs:
114117
uses: actions-rs/toolchain@v1
115118
with:
116119
profile: default
117-
toolchain: '1.81'
120+
toolchain: "1.81"
118121
override: true
119122

120123
# Install Java and Hadoop for HDFS integration tests
@@ -129,6 +132,9 @@ jobs:
129132
tar -xf hadoop-3.4.0.tar.gz -C $GITHUB_WORKSPACE
130133
echo "$GITHUB_WORKSPACE/hadoop-3.4.0/bin" >> $GITHUB_PATH
131134
135+
- name: Load DAT data
136+
uses: ./.github/actions/load-dat
137+
132138
- name: Start emulated services
133139
run: docker compose up -d
134140

@@ -160,7 +166,7 @@ jobs:
160166
uses: actions-rs/toolchain@v1
161167
with:
162168
profile: default
163-
toolchain: '1.81'
169+
toolchain: "1.81"
164170
override: true
165171

166172
- name: Download Lakectl
@@ -175,4 +181,3 @@ jobs:
175181
- name: Run tests with rustls (default)
176182
run: |
177183
cargo test --features integration_test_lakefs,lakefs,datafusion
178-

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ debug = true
2626
debug = "line-tables-only"
2727

2828
[workspace.dependencies]
29-
#delta_kernel = { version = "=0.6.0", features = ["default-engine"] }
30-
delta_kernel = { path = "../delta-kernel-rs/kernel", features = [
31-
"default-engine",
32-
"developer-visibility",
33-
] }
34-
# delta_kernel = { git = "https://github.com/roeap/delta-kernel-rs", rev = "fcc43b50dafdc5e6b84c206492bbde8ed1115529", features = [
29+
# delta_kernel = { version = "=0.6.0", features = ["default-engine"] }
30+
# delta_kernel = { path = "../delta-kernel-rs/kernel", features = [
3531
# "default-engine",
3632
# "developer-visibility",
3733
# ] }
34+
delta_kernel = { git = "https://github.com/roeap/delta-kernel-rs", rev = "caeb70ab78e4d5f3b56b5105fd3587c1046d1e1b", features = [
35+
"default-engine",
36+
"developer-visibility",
37+
] }
3838

3939
# arrow
4040
arrow = { version = "53" }
@@ -48,7 +48,7 @@ arrow-ord = { version = "53" }
4848
arrow-row = { version = "53" }
4949
arrow-schema = { version = "53" }
5050
arrow-select = { version = "53" }
51-
object_store = { version = "0.11.2" , features = ["cloud"]}
51+
object_store = { version = "0.11.2", features = ["cloud"] }
5252
parquet = { version = "53" }
5353

5454
# datafusion

crates/core/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ datafusion-functions-aggregate = { workspace = true, optional = true }
4646
# serde
4747
serde = { workspace = true, features = ["derive"] }
4848
serde_json = { workspace = true }
49-
strum = { workspace = true}
49+
strum = { workspace = true }
5050

5151
# "stdlib"
5252
bytes = { workspace = true }
@@ -132,3 +132,7 @@ datafusion = [
132132
datafusion-ext = ["datafusion"]
133133
json = ["parquet/json"]
134134
python = ["arrow/pyarrow"]
135+
136+
[[test]]
137+
name = "dat"
138+
harness = false

crates/core/tests/dat.rs

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
use std::path::Path;
2+
use std::sync::Arc;
3+
4+
use delta_kernel::Table;
5+
use deltalake_core::kernel::snapshot_next::{LazySnapshot, Snapshot};
6+
use deltalake_test::acceptance::read_dat_case;
7+
8+
static SKIPPED_TESTS: &[&str; 1] = &["iceberg_compat_v1"];
9+
10+
fn reader_test_lazy(path: &Path) -> datatest_stable::Result<()> {
11+
let root_dir = format!(
12+
"{}/{}",
13+
env!["CARGO_MANIFEST_DIR"],
14+
path.parent().unwrap().to_str().unwrap()
15+
);
16+
for skipped in SKIPPED_TESTS {
17+
if root_dir.ends_with(skipped) {
18+
println!("Skipping test: {}", skipped);
19+
return Ok(());
20+
}
21+
}
22+
23+
tokio::runtime::Builder::new_current_thread()
24+
.enable_all()
25+
.build()?
26+
.block_on(async {
27+
let case = read_dat_case(root_dir).unwrap();
28+
29+
let table = Table::try_from_uri(case.table_root().unwrap()).expect("table");
30+
let snapshot = LazySnapshot::try_new(
31+
table,
32+
Arc::new(object_store::local::LocalFileSystem::default()),
33+
None,
34+
)
35+
.await
36+
.unwrap();
37+
38+
let table_info = case.table_summary().expect("load summary");
39+
assert_eq!(snapshot.version(), table_info.version);
40+
assert_eq!(
41+
(
42+
snapshot.protocol().min_reader_version(),
43+
snapshot.protocol().min_writer_version()
44+
),
45+
(table_info.min_reader_version, table_info.min_writer_version)
46+
);
47+
});
48+
Ok(())
49+
}
50+
51+
fn reader_test_eager(path: &Path) -> datatest_stable::Result<()> {
52+
let root_dir = format!(
53+
"{}/{}",
54+
env!["CARGO_MANIFEST_DIR"],
55+
path.parent().unwrap().to_str().unwrap()
56+
);
57+
for skipped in SKIPPED_TESTS {
58+
if root_dir.ends_with(skipped) {
59+
println!("Skipping test: {}", skipped);
60+
return Ok(());
61+
}
62+
}
63+
64+
tokio::runtime::Builder::new_current_thread()
65+
.enable_all()
66+
.build()?
67+
.block_on(async {
68+
let case = read_dat_case(root_dir).unwrap();
69+
70+
let table = Table::try_from_uri(case.table_root().unwrap()).expect("table");
71+
let snapshot = LazySnapshot::try_new(
72+
table,
73+
Arc::new(object_store::local::LocalFileSystem::default()),
74+
None,
75+
)
76+
.await
77+
.unwrap();
78+
79+
let table_info = case.table_summary().expect("load summary");
80+
assert_eq!(snapshot.version(), table_info.version);
81+
assert_eq!(
82+
(
83+
snapshot.protocol().min_reader_version(),
84+
snapshot.protocol().min_writer_version()
85+
),
86+
(table_info.min_reader_version, table_info.min_writer_version)
87+
);
88+
});
89+
Ok(())
90+
}
91+
92+
datatest_stable::harness!(
93+
reader_test_lazy,
94+
"../../dat/out/reader_tests/generated/",
95+
r"test_case_info\.json",
96+
reader_test_eager,
97+
"../../dat/out/reader_tests/generated/",
98+
r"test_case_info\.json"
99+
);

0 commit comments

Comments
 (0)