From 0ad4680d9b6595f73bf7dbefe88f7de09fd14ed7 Mon Sep 17 00:00:00 2001 From: jordanrfrazier <122494242+jordanrfrazier@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:29:24 -0700 Subject: [PATCH] ref: fix circular dependencies (#844) Moves the sparrow-plan-execution test into sparrow-session to avoid circular dependencies. --- Cargo.lock | 4 ++-- crates/sparrow-batch/Cargo.toml | 1 - crates/sparrow-plan-execution/Cargo.toml | 1 - crates/sparrow-plan-execution/src/lib.rs | 3 --- crates/sparrow-session/Cargo.toml | 2 ++ crates/sparrow-session/src/partitioned.rs | 3 +++ crates/sparrow-session/src/partitioned/partitioned.rs | 1 + .../src/partitioned/tests/basic_tests.rs} | 7 ++----- crates/sparrow-session/src/tests.rs | 2 ++ 9 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 crates/sparrow-session/src/partitioned/partitioned.rs rename crates/{sparrow-plan-execution/src/tests.rs => sparrow-session/src/partitioned/tests/basic_tests.rs} (95%) create mode 100644 crates/sparrow-session/src/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 85b0be2bb..5b752ccc0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4358,7 +4358,6 @@ dependencies = [ "error-stack", "itertools 0.11.0", "proptest", - "sparrow-merge", "sparrow-testing", "static_init", ] @@ -4734,7 +4733,6 @@ dependencies = [ "sparrow-merge", "sparrow-physical", "sparrow-scheduler", - "sparrow-session", "sparrow-testing", "sparrow-transforms", "tokio", @@ -4881,6 +4879,7 @@ dependencies = [ "sparrow-api", "sparrow-backend", "sparrow-compiler", + "sparrow-expressions", "sparrow-instructions", "sparrow-interfaces", "sparrow-io", @@ -4888,6 +4887,7 @@ dependencies = [ "sparrow-plan-execution", "sparrow-runtime", "sparrow-syntax", + "sparrow-testing", "static_init", "tempfile", "tokio", diff --git a/crates/sparrow-batch/Cargo.toml b/crates/sparrow-batch/Cargo.toml index 27b2b216f..38e42f79d 100644 --- a/crates/sparrow-batch/Cargo.toml +++ b/crates/sparrow-batch/Cargo.toml @@ -25,7 +25,6 @@ proptest = { workspace = true, optional = true } [dev-dependencies] sparrow-testing = { path = "../sparrow-testing" } -sparrow-merge = { path = "../sparrow-merge" } proptest.workspace = true [lib] diff --git a/crates/sparrow-plan-execution/Cargo.toml b/crates/sparrow-plan-execution/Cargo.toml index 350d13b6f..44732f4a1 100644 --- a/crates/sparrow-plan-execution/Cargo.toml +++ b/crates/sparrow-plan-execution/Cargo.toml @@ -36,7 +36,6 @@ index_vec.workspace = true sparrow-backend = { path = "../sparrow-backend" } sparrow-expressions = { path = "../sparrow-expressions" } sparrow-logical = { path = "../sparrow-logical" } -sparrow-session = { path = "../sparrow-session" } sparrow-testing = { path = "../sparrow-testing" } [lib] diff --git a/crates/sparrow-plan-execution/src/lib.rs b/crates/sparrow-plan-execution/src/lib.rs index 8b54748d6..46f1e6617 100644 --- a/crates/sparrow-plan-execution/src/lib.rs +++ b/crates/sparrow-plan-execution/src/lib.rs @@ -31,9 +31,6 @@ mod error; mod source_tasks; mod write_pipeline; -#[cfg(test)] -mod tests; - pub use error::*; use crate::source_tasks::SourceTasks; diff --git a/crates/sparrow-session/Cargo.toml b/crates/sparrow-session/Cargo.toml index 9b888aae5..8fed5e32b 100644 --- a/crates/sparrow-session/Cargo.toml +++ b/crates/sparrow-session/Cargo.toml @@ -35,6 +35,8 @@ tokio-stream.workspace = true uuid.workspace = true [dev-dependencies] +sparrow-expressions = { path = "../sparrow-expressions" } +sparrow-testing = { path = "../sparrow-testing" } [lib] bench = false diff --git a/crates/sparrow-session/src/partitioned.rs b/crates/sparrow-session/src/partitioned.rs index bfd66dd63..9e1241401 100644 --- a/crates/sparrow-session/src/partitioned.rs +++ b/crates/sparrow-session/src/partitioned.rs @@ -1,2 +1,5 @@ mod session; pub use session::*; + +#[cfg(tests)] +mod tests; diff --git a/crates/sparrow-session/src/partitioned/partitioned.rs b/crates/sparrow-session/src/partitioned/partitioned.rs new file mode 100644 index 000000000..ddf7753c4 --- /dev/null +++ b/crates/sparrow-session/src/partitioned/partitioned.rs @@ -0,0 +1 @@ +mod basic_tests; diff --git a/crates/sparrow-plan-execution/src/tests.rs b/crates/sparrow-session/src/partitioned/tests/basic_tests.rs similarity index 95% rename from crates/sparrow-plan-execution/src/tests.rs rename to crates/sparrow-session/src/partitioned/tests/basic_tests.rs index 6aba5bd28..a81b48948 100644 --- a/crates/sparrow-plan-execution/src/tests.rs +++ b/crates/sparrow-session/src/partitioned/tests/basic_tests.rs @@ -1,17 +1,14 @@ +use crate::partitioned::Session; use arrow_array::cast::AsArray; use arrow_array::{Int64Array, RecordBatch, TimestampNanosecondArray, UInt64Array}; use sparrow_interfaces::source::{Source, SourceExt}; use sparrow_io::in_memory::InMemorySource; use sparrow_logical::ExprRef; -use sparrow_session::partitioned::Session; use std::sync::Arc; use arrow_schema::{DataType, Field, Schema}; -fn query( - session: &Session, - source: ExprRef, -) -> error_stack::Result { +fn query(session: &Session, source: ExprRef) -> error_stack::Result { let a_str = session.add_literal(sparrow_logical::Literal::new_str("a"))?; let a = session.add_expr("fieldref", vec![source.clone(), a_str])?; diff --git a/crates/sparrow-session/src/tests.rs b/crates/sparrow-session/src/tests.rs new file mode 100644 index 000000000..4b6f19529 --- /dev/null +++ b/crates/sparrow-session/src/tests.rs @@ -0,0 +1,2 @@ +//! Partitioned execution tests +mod partitioned;