Skip to content

Commit

Permalink
Fix circular dependencies, moving tests into sparrow-session
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanrfrazier committed Nov 1, 2023
1 parent 7508a6d commit efd5ba9
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/sparrow-batch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 0 additions & 1 deletion crates/sparrow-plan-execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 0 additions & 3 deletions crates/sparrow-plan-execution/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ mod error;
mod source_tasks;
mod write_pipeline;

#[cfg(test)]
mod tests;

pub use error::*;

use crate::source_tasks::SourceTasks;
Expand Down
2 changes: 2 additions & 0 deletions crates/sparrow-session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ smallvec.workspace = true
sparrow-api = { path = "../sparrow-api" }
sparrow-backend = { path = "../sparrow-backend" }
sparrow-compiler = { path = "../sparrow-compiler" }
sparrow-expressions = { path = "../sparrow-expressions" }
sparrow-instructions = { path = "../sparrow-instructions" }
sparrow-interfaces = { path = "../sparrow-interfaces" }
sparrow-logical = { path = "../sparrow-logical" }
sparrow-plan-execution = { path = "../sparrow-plan-execution" }
sparrow-runtime = { path = "../sparrow-runtime" }
sparrow-io = { path = "../sparrow-io" }
sparrow-syntax = { path = "../sparrow-syntax" }
sparrow-testing = { path = "../sparrow-testing" }
static_init.workspace = true
tempfile.workspace = true
tokio.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/sparrow-session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod expr;
pub mod partitioned;
mod session;
mod table;
mod tests;

pub use error::Error;
pub use execution::Execution;
Expand Down
2 changes: 2 additions & 0 deletions crates/sparrow-session/src/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//! Partitioned execution tests
mod partitioned;
2 changes: 2 additions & 0 deletions crates/sparrow-session/src/tests/partitioned.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#[cfg(test)]
mod basic_tests;
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
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<ExprRef, sparrow_session::Error> {
#[cfg(test)]
fn query(session: &Session, source: ExprRef) -> error_stack::Result<ExprRef, crate::Error> {
let a_str = session.add_literal(sparrow_logical::Literal::new_str("a"))?;
let a = session.add_expr("fieldref", vec![source.clone(), a_str])?;

Expand All @@ -29,6 +27,7 @@ fn query(
session.add_expr("record", vec![ab_str, a_plus_b, abc_str, a_plus_b_plus_c])
}

#[cfg(test)]
fn add_input_batch(session: &Session, source: &Arc<dyn Source>) {
let source_prepared_schema = Arc::new(Schema::new(vec![
Field::new(
Expand Down

0 comments on commit efd5ba9

Please sign in to comment.