-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Depend on wider arrow versions, add integration test (#366)
This widens our arrow dependency and adds a basic integration test. Note that the patching workflow is not 100% ideal as it requires a version specification that reduces to exactly one version. I don't think there's a way around this, so we may want to in the future adjust to a feature flag based approach. That's a lot more work though, so we'll do this for now and unblock people using older arrow versions, and then iterate if needed. At this point, the test just makes sure we can compile (and run a trivial program) with all the versions of arrow we say we support. It creates an arrow schema and a kernel schema, and then compares them to make sure the versions work together. The testing script pulls all versions of arrow, checks that it's in the range we support, then `sed`s each one into the `integration-test`'s `Cargo.toml` as both the required version of arrow and as the versions in the `[patch]` section. Then compiles and runs the crate. Reviewers, recommend you also look at the workflow jobs triggered to see what the tests do. --------- Co-authored-by: Nick Lanham <[email protected]>
- Loading branch information
Showing
7 changed files
with
160 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Run tests to ensure we can compile across arrow versions | ||
|
||
on: [workflow_dispatch, push, pull_request] | ||
|
||
jobs: | ||
arrow_integration_test: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 20 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- macOS-latest | ||
- ubuntu-latest | ||
- windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install minimal stable rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: default | ||
toolchain: stable | ||
override: true | ||
- uses: Swatinem/rust-cache@v2 | ||
- name: run integration tests | ||
shell: bash | ||
run: pushd integration-tests && ./test-all-arrow-versions.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
.cargo/ | ||
target/ | ||
/Cargo.lock | ||
integration-tests/Cargo.lock | ||
|
||
# Project | ||
acceptance/tests/dat/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
name = "integration-tests" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[workspace] | ||
|
||
[dependencies] | ||
arrow = "=52.1.0" | ||
delta_kernel = { path = "../kernel", features = ["arrow-conversion"] } | ||
|
||
[patch.'file:///../kernel'] | ||
arrow = "=52.1.0" | ||
arrow-arith = "=52.1.0" | ||
arrow-array = "=52.1.0" | ||
arrow-buffer = "=52.1.0" | ||
arrow-cast = "=52.1.0" | ||
arrow-data = "=52.1.0" | ||
arrow-ord = "=52.1.0" | ||
arrow-json = "=52.1.0" | ||
arrow-select = "=52.1.0" | ||
arrow-schema = "=52.1.0" | ||
parquet = "=52.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
fn create_arrow_schema() -> arrow::datatypes::Schema { | ||
use arrow::datatypes::{DataType, Field, Schema}; | ||
let field_a = Field::new("a", DataType::Int64, false); | ||
let field_b = Field::new("b", DataType::Boolean, false); | ||
Schema::new(vec![field_a, field_b]) | ||
} | ||
|
||
fn create_kernel_schema() -> delta_kernel::schema::Schema { | ||
use delta_kernel::schema::{DataType, Schema, StructField}; | ||
let field_a = StructField::new("a", DataType::LONG, false); | ||
let field_b = StructField::new("b", DataType::BOOLEAN, false); | ||
Schema::new(vec![field_a, field_b]) | ||
} | ||
|
||
fn main() { | ||
let arrow_schema = create_arrow_schema(); | ||
let kernel_schema = create_kernel_schema(); | ||
let convereted: delta_kernel::schema::Schema = | ||
delta_kernel::schema::Schema::try_from(&arrow_schema).expect("couldn't convert"); | ||
assert!(kernel_schema == convereted); | ||
println!("Okay, made it"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
|
||
is_version_le() { | ||
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ] | ||
} | ||
|
||
is_version_lt() { | ||
if [ "$1" = "$2" ] | ||
then | ||
return 1 | ||
else | ||
is_version_le "$1" "$2" | ||
fi | ||
} | ||
|
||
test_arrow_version() { | ||
ARROW_VERSION="$1" | ||
echo "== Testing version $ARROW_VERSION ==" | ||
sed -i'' -e "s/\(arrow[^\"]*=[^\"]*\).*/\1\"=$ARROW_VERSION\"/" Cargo.toml | ||
sed -i'' -e "s/\(parquet[^\"]*\).*/\1\"=$ARROW_VERSION\"/" Cargo.toml | ||
cargo clean | ||
rm -f Cargo.lock | ||
cargo update | ||
cat Cargo.toml | ||
cargo run | ||
} | ||
|
||
MIN_ARROW_VER="52.0.0" | ||
MAX_ARROW_VER="54.0.0" | ||
|
||
for ARROW_VERSION in $(curl -s https://crates.io/api/v1/crates/arrow | jq -r '.versions[].num' | tr -d '\r') | ||
do | ||
if ! is_version_lt "$ARROW_VERSION" "$MIN_ARROW_VER" && is_version_lt "$ARROW_VERSION" "$MAX_ARROW_VER" | ||
then | ||
test_arrow_version "$ARROW_VERSION" | ||
fi | ||
done |