Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,306 changes: 576 additions & 730 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 12 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,20 @@ edition = "2024"
rust-version = "1.88.0"

[workspace.dependencies]
arrow = { version = "58.4", features = ["ipc_compression"] }
arrow-flight = { version = "58.4", features = ["flight-sql-experimental"] }
arrow = { version = "59.2.0", features = ["ipc_compression"] }
arrow-flight = { version = "59.2.0", features = ["flight-sql-experimental"] }
clap = { version = "4.5", features = ["derive", "cargo"] }

# Keep these as minor-version requirements rather than exact patch pins. The
# python workspace shares these crates through path dependencies, and
# datafusion-python lags behind datafusion patch releases, so pinning a patch
# here can break the wheel build. Cargo.lock records the exact patch version.
datafusion = "54"
datafusion-cli = "54"
datafusion-functions-aggregate-common = "54"
datafusion-proto = "54"
datafusion-proto-common = "54"
datafusion-spark = "54"
datafusion-substrait = "54"
# DataFusion crates are pinned to a git rev of apache/datafusion main rather than
# a crates.io release. Bump this rev to advance to newer DataFusion commits.
datafusion = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }
datafusion-cli = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }
datafusion-ffi = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }
datafusion-functions-aggregate-common = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }
datafusion-proto = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }
datafusion-proto-common = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }
datafusion-spark = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }
datafusion-substrait = { git = "https://github.com/apache/datafusion.git", rev = "e08aed1e5de41dcf81d529140dae07723b942a5e" }

ctor = { version = "1.0" }
insta = "1.47"
Expand Down
34 changes: 17 additions & 17 deletions ballista/client/tests/context_checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1180,23 +1180,23 @@ mod supported {
)?;

let expected = [
"+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
"| plan_type | plan |",
"+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
"| Plan with Metrics | =========SuccessfulStage[stage_id=1, partitions=1]========= |",
"| | SortShuffleWriterExec: partitioning=Hash([id@0], 16), metrics=[output_rows=..., input_rows=..., spill_bytes=..., spill_count=..., repart_time=..., spill_time=..., write_time=...] |",
"| | AggregateExec: mode=Partial, gby=[id@0 as id], aggr=[count(Int64(1))], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., spill_count=..., spilled_bytes=..., spilled_rows=..., skipped_aggregation_rows=..., peak_mem_used=..., aggregate_arguments_time=..., aggregation_time=..., emitting_time=..., time_calculating_group_ids=..., reduction_factor=...] |",
"| | ProjectionExec: expr=[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1)@0 as id], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., expr_0_eval_time=...] |",
"| | UnnestExec, metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., input_batches=..., input_rows=...] |",
"| | ProjectionExec: expr=[[1, 2, 3, 4, 5] as __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., expr_0_eval_time=...] |",
"| | PlaceholderRowExec, metrics=[...] |",
"| | |",
"| | =========SuccessfulStage[stage_id=2, partitions=16]========= |",
"| | ShuffleWriterExec: partitioning: None, metrics=[output_rows=..., input_rows=..., write_time=...] |",
"| | ProjectionExec: expr=[count(Int64(1))@1 as count(*), id@0 as id], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., expr_0_eval_time=..., expr_1_eval_time=...] |",
"| | AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[count(Int64(1))], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., spill_count=..., spilled_bytes=..., spilled_rows=..., peak_mem_used=..., aggregate_arguments_time=..., aggregation_time=..., emitting_time=..., time_calculating_group_ids=...] |",
"| | ShuffleReaderExec: upstream_stage: 1, partitioning: Hash([id@0], 16), metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., decoded_bytes=..., fetch_requests=..., fetch_retries=..., local_partitions=..., remote_partitions=..., fetch_time=..., local_read_time=..., permit_wait_time=...] |",
"+-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
"+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
"| plan_type | plan |",
"+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
"| Plan with Metrics | =========SuccessfulStage[stage_id=1, partitions=1]========= |",
"| | SortShuffleWriterExec: partitioning=Hash([id@0], 16), metrics=[output_rows=..., input_rows=..., spill_bytes=..., spill_count=..., repart_time=..., spill_time=..., write_time=...] |",
"| | AggregateExec: mode=Partial, gby=[id@0 as id], aggr=[count(Int64(1))], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., spill_count=..., spilled_bytes=..., spilled_rows=..., skipped_aggregation_rows=..., aggregate_arguments_time=..., aggregation_time=..., emitting_time=..., time_calculating_group_ids=..., reduction_factor=...] |",
"| | ProjectionExec: expr=[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1)@0 as id], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., expr_0_eval_time=...] |",
"| | UnnestExec, metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., input_batches=..., input_rows=...] |",
"| | ProjectionExec: expr=[[1, 2, 3, 4, 5] as __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., expr_0_eval_time=...] |",
"| | PlaceholderRowExec, metrics=[...] |",
"| | |",
"| | =========SuccessfulStage[stage_id=2, partitions=16]========= |",
"| | ShuffleWriterExec: partitioning: None, metrics=[output_rows=..., input_rows=..., write_time=...] |",
"| | ProjectionExec: expr=[count(Int64(1))@1 as count(*), id@0 as id], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., expr_0_eval_time=..., expr_1_eval_time=...] |",
"| | AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[count(Int64(1))], metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., spill_count=..., spilled_bytes=..., spilled_rows=..., aggregate_arguments_time=..., aggregation_time=..., emitting_time=..., time_calculating_group_ids=...] |",
"| | ShuffleReaderExec: upstream_stage: 1, partitioning: Hash([id@0], 16), metrics=[output_rows=..., elapsed_compute=..., output_bytes=..., output_batches=..., decoded_bytes=..., fetch_requests=..., fetch_retries=..., local_partitions=..., remote_partitions=..., fetch_time=..., local_read_time=..., permit_wait_time=...] |",
"+-------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
];

assert_batches_eq!(expected, &[sanitized]);
Expand Down
20 changes: 11 additions & 9 deletions ballista/client/tests/context_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ mod standalone {
use ballista_core::serde::BallistaPhysicalExtensionCodec;
use datafusion::{
assert_batches_eq,
catalog::Session,
common::exec_err,
execution::{
SessionState, SessionStateBuilder, TaskContext, context::QueryPlanner,
},
execution::{SessionStateBuilder, TaskContext, context::QueryPlanner},
logical_expr::LogicalPlan,
physical_plan::ExecutionPlan,
prelude::{SessionConfig, SessionContext},
};
use datafusion_proto::{
logical_plan::LogicalExtensionCodec, physical_plan::PhysicalExtensionCodec,
logical_plan::LogicalExtensionCodec,
physical_plan::{PhysicalExtensionCodec, PhysicalProtoConverterExtension},
};

#[tokio::test]
Expand Down Expand Up @@ -299,7 +299,7 @@ mod standalone {
fn try_decode_table_provider(
&self,
_buf: &[u8],
_table_ref: &datafusion::sql::TableReference,
_table_ref: &datafusion::common::TableReference,
_schema: datafusion::arrow::datatypes::SchemaRef,
_ctx: &TaskContext,
) -> datafusion::error::Result<
Expand All @@ -312,7 +312,7 @@ mod standalone {

fn try_encode_table_provider(
&self,
_table_ref: &datafusion::sql::TableReference,
_table_ref: &datafusion::common::TableReference,
_node: std::sync::Arc<dyn datafusion::catalog::TableProvider>,
_buf: &mut Vec<u8>,
) -> datafusion::error::Result<()> {
Expand Down Expand Up @@ -366,21 +366,23 @@ mod standalone {
buf: &[u8],
inputs: &[Arc<dyn datafusion::physical_plan::ExecutionPlan>],
ctx: &TaskContext,
proto_converter: &dyn PhysicalProtoConverterExtension,
) -> datafusion::error::Result<Arc<dyn datafusion::physical_plan::ExecutionPlan>>
{
self.invoked
.store(true, std::sync::atomic::Ordering::Relaxed);
self.codec.try_decode(buf, inputs, ctx)
self.codec.try_decode(buf, inputs, ctx, proto_converter)
}

fn try_encode(
&self,
node: Arc<dyn datafusion::physical_plan::ExecutionPlan>,
buf: &mut Vec<u8>,
proto_converter: &dyn PhysicalProtoConverterExtension,
) -> datafusion::error::Result<()> {
self.invoked
.store(true, std::sync::atomic::Ordering::Relaxed);
self.codec.try_encode(node, buf)
self.codec.try_encode(node, buf, proto_converter)
}
}

Expand All @@ -392,7 +394,7 @@ mod standalone {
async fn create_physical_plan(
&self,
_logical_plan: &LogicalPlan,
_session_state: &SessionState,
_session_state: &dyn Session,
) -> datafusion::error::Result<Arc<dyn ExecutionPlan>> {
exec_err!("does not work")
}
Expand Down
8 changes: 8 additions & 0 deletions ballista/core/proto/ballista.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ message BallistaPhysicalPlanNode {
UnorderedRangeRepartitionExecNode unordered_range_repartition = 8;
OrderedRangeRepartitionExecNode ordered_range_repartition = 9;
PerPartitionFilterExecNode per_partition_filter = 10;
DistributedQueryExecNode distributed_query = 11;
}
}

message DistributedQueryExecNode {
string scheduler_url = 1;
repeated KeyValuePair settings = 2;
bytes logical_plan = 3;
string session_id = 4;
}

// Value-range router over N locally-sorted overlapping input partitions.
// Redistributes them into K range-disjoint output partitions where each
// output is fully sorted on the routing expression. Uses N × K scatter
Expand Down
Loading
Loading