ccciudatu commented on code in PR #11938:
URL: https://github.com/apache/datafusion/pull/11938#discussion_r1716654822
##########
datafusion/proto/src/physical_plan/mod.rs:
##########
@@ -1081,6 +1091,67 @@ impl AsExecutionPlan for protobuf::PhysicalPlanNode {
sort_order,
)))
}
+ #[cfg(feature = "flight")]
+ PhysicalPlanType::FlightScan(flight_scan) => {
+ let partitions = flight_scan
+ .partitions
+ .iter()
+ .map(|partition_node| {
+ FlightPartition::restore(
+ partition_node.locations.clone(),
+ partition_node.token.clone(),
+ )
+ })
+ .collect();
+ let plan_props =
+ flight_scan.plan_properties.clone().ok_or_else(|| {
+ DataFusionError::Internal(
+ "Missing plan_properties in FlightExec".into(),
+ )
+ })?;
+ let schema: Arc<Schema> =
Arc::new(convert_required!(plan_props.schema)?);
+ let codec = DefaultPhysicalExtensionCodec {};
+ let partitioning = parse_protobuf_partitioning(
+ plan_props.partitioning.as_ref(),
+ registry,
+ schema.as_ref(),
+ &codec,
+ )?
+ .ok_or_else(|| {
+ DataFusionError::Internal(
+ "Missing partitioning from plan properties".into(),
+ )
+ })?;
+ let orderings = &plan_props
+ .output_ordering
+ .iter()
+ .map(|node_collection| {
+ parse_physical_sort_exprs(
+ &node_collection.physical_sort_expr_nodes,
+ registry,
+ &schema,
+ &codec,
+ )
+ .unwrap()
+ })
+ .collect::<Vec<_>>();
+ let eq_props =
+ EquivalenceProperties::new_with_orderings(schema,
orderings);
+ let execution_mode = match plan_props.execution_mode {
+ 0 => ExecutionMode::Bounded,
+ 1 => ExecutionMode::Unbounded,
+ 2 => ExecutionMode::PipelineBreaking,
+ _ => unreachable!("Unexpected execution mode"),
+ };
+ let plan_properties =
+ PlanProperties::new(eq_props, partitioning,
execution_mode);
+
+ Ok(Arc::new(FlightExec::restore(
+ partitions,
+ plan_properties,
+ &flight_scan.grpc_headers,
+ )))
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]