Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Merge remote-tracking branch 'apache/main' into inlist-deser-error
  • Loading branch information
alamb committed Aug 19, 2025
commit 1bb7b887048d0f5ff6963e54613d3ddf876bfc1a
35 changes: 35 additions & 0 deletions datafusion/proto/tests/cases/roundtrip_physical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,41 @@ async fn test_tpch_part_in_list_query_with_real_parquet_data() -> Result<()> {
// This will fail with the bug, but should succeed when fixed
let _deserialized_plan =
proto.try_into_physical_plan(&ctx, ctx.runtime_env().as_ref(), &codec)?;
Ok(())
}

#[tokio::test]
/// Tests that we can serialize an unoptimized "analyze" plan and it will work on the other end
async fn analyze_roundtrip_unoptimized() -> Result<()> {
let ctx = SessionContext::new();

// No optimizations
let session_state =
datafusion::execution::SessionStateBuilder::new_from_existing(ctx.state())
.with_physical_optimizer_rules(vec![])
.build();

let logical_plan = session_state
.create_logical_plan("explain analyze select 1")
.await?;
let plan = session_state.create_physical_plan(&logical_plan).await?;

let node = PhysicalPlanNode::try_from_physical_plan(
plan.clone(),
&DefaultPhysicalExtensionCodec {},
)?;

let node = PhysicalPlanNode::decode(node.encode_to_vec().as_slice())
.map_err(|e| DataFusionError::External(Box::new(e)))?;

let unoptimized = node.try_into_physical_plan(
&ctx,
ctx.runtime_env().as_ref(),
&DefaultPhysicalExtensionCodec {},
)?;

let physical_planner =
datafusion::physical_planner::DefaultPhysicalPlanner::default();
physical_planner.optimize_physical_plan(unoptimized, &session_state, |_, _| {})?;
Ok(())
}
You are viewing a condensed version of this merge commit. You can view the full changes here.