Skip to content

Commit

Permalink
draft: feat: compile and execute partitioned query
Browse files Browse the repository at this point in the history
The main change here is having the `sparrow-execution` tests compile
from a logical plan, created within a session, and execute things.

Changes Include

- Fix naming `field_ref` vs. `fieldref` (matches Python)
- Tweak pipeline scheduling so that only transforms are grouped together.
- Tweak pipelines so that each may output to multiple consumers
- Start introducing a `SourceTasks` so we can poll all inputs on a single
  tokio task.
- Fixes to how the scheduler detects "completion" (empty queue isn't
  sufficient).

Likely follow-ups needed:

- Use `park` and `unpark` so the worker threads don't spin

TODO

- [x] Actually execute the compiled query
- [ ] Replace `ScalarValue` with arrows scalar? Literal too?
- [ ] Move logical expr building to session (out of sparrow-logical)
- [ ] Look at compiling out `tracing::trace` level statements.
- [ ] Look at running the query in the sessions tokio runtime
  • Loading branch information
bjchambers committed Oct 12, 2023
1 parent 13be46f commit 24ccecb
Show file tree
Hide file tree
Showing 44 changed files with 1,275 additions and 524 deletions.
30 changes: 12 additions & 18 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ tonic = "0.9.2"
tonic-build = { version = "0.9.2", features = ["prost"] }
tonic-health = "0.9.2"
tonic-reflection = "0.9.2"
tracing = "0.1.37"
tracing = { version = "0.1.37", features = ["release_max_level_debug"] }
tracing-error = "0.2.0"
tracing-opentelemetry = "0.19.0"
tracing-serde = "0.1.3"
Expand Down
7 changes: 5 additions & 2 deletions crates/sparrow-arrow/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ itertools.workspace = true
num.workspace = true
proptest = { workspace = true, optional = true }
serde.workspace = true
static_init.workspace = true
tracing.workspace = true

[dev-dependencies]
Expand All @@ -43,4 +42,8 @@ insta.workspace = true
proptest.workspace = true

[lib]
doctest = false
doctest = false

[package.metadata.cargo-machete]
# Optional package enabled by `testing`
ignored = ["proptest"]
2 changes: 1 addition & 1 deletion crates/sparrow-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ index_vec.workspace = true
itertools.workspace = true
smallvec.workspace = true
sparrow-arrow = { path = "../sparrow-arrow" }
sparrow-core = { path = "../sparrow-core" }
sparrow-expressions = { path = "../sparrow-expressions" }
sparrow-logical = { path = "../sparrow-logical" }
sparrow-physical = { path = "../sparrow-physical" }
uuid.workspace = true
static_init.workspace = true
tracing.workspace = true

[dev-dependencies]
insta.workspace = true
Expand Down
7 changes: 6 additions & 1 deletion crates/sparrow-backend/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ pub fn compile(
Cow::Owned(CompileOptions::default())
};

let physical = LogicalToPhysical::new().apply(root)?;
// Convert the logical expression tree to a physical plan.
let mut physical = LogicalToPhysical::new().apply(root)?;

// Schedule the steps in the physical plan.
physical.pipelines = crate::pipeline_schedule(&physical.steps);

Ok(physical)
}
Loading

0 comments on commit 24ccecb

Please sign in to comment.