Skip to content

Commit f7ab87a

Browse files
adriangbclaude
andcommitted
refactor(proto): remove the FromProto / TryFromProto workaround
apache#21929 introduced these traits so the `datafusion-proto-models` extraction could land without simultaneously relocating ~39 conversions, and flagged them there as "a known workaround, not the end state". Every one of those conversions now lives in a crate that owns one side of it, as a plain `From` / `TryFrom`, so the traits and `convert_required_proto!` have no implementors and no callers. Neither trait has ever shipped in a release, so this removes them outright rather than deprecating: there is nothing for downstream users to migrate off. Doing it before 55.0.0 keeps the workaround out of the released API entirely. Closes apache#24019. Co-Authored-By: Claude Opus 5 <[email protected]>
1 parent 4d91570 commit f7ab87a

4 files changed

Lines changed: 2 additions & 67 deletions

File tree

‎datafusion/physical-expr-common/src/physical_expr.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,8 @@ pub trait PhysicalExpr: Any + Send + Sync + Display + Debug + DynEq + DynHash {
498498
/// <https://github.com/apache/datafusion/issues/21835>.
499499
///
500500
/// The `try_` prefix matches the fallible `try_from_proto` decode
501-
/// constructors (and the `TryFromProto` trait in `datafusion-proto`);
502-
/// both sides of the round-trip are fallible and named consistently.
501+
/// constructors; both sides of the round-trip are fallible and named
502+
/// consistently.
503503
///
504504
/// [`PhysicalExprNode`]: datafusion_proto_models::protobuf::PhysicalExprNode
505505
#[cfg(feature = "proto")]

‎datafusion/proto/src/common.rs‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,6 @@ macro_rules! convert_required {
2626
}};
2727
}
2828

29-
/// Like [`convert_required`] but for types whose proto conversion goes through
30-
/// the [`TryFromProto`](crate::convert::TryFromProto) trait instead of
31-
/// [`TryFrom`]. Required because some prost-generated types now live in a
32-
/// separate crate, so `TryFrom`/`From` cannot be implemented on foreign-foreign
33-
/// pairs from `datafusion-proto` directly.
34-
#[macro_export]
35-
macro_rules! convert_required_proto {
36-
($T:ty, $PB:expr) => {{
37-
if let Some(field) = $PB.as_ref() {
38-
Ok::<$T, _>(<$T as $crate::convert::TryFromProto<_>>::try_from_proto(
39-
field,
40-
)?)
41-
} else {
42-
Err(proto_error("Missing required field in protobuf"))
43-
}
44-
}};
45-
}
46-
4729
#[macro_export]
4830
macro_rules! into_required {
4931
($PB:expr) => {{

‎datafusion/proto/src/convert.rs‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎datafusion/proto/src/lib.rs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,9 @@
123123
//! ```
124124
pub mod bytes;
125125
pub mod common;
126-
pub mod convert;
127126
pub mod logical_plan;
128127
pub mod physical_plan;
129128

130-
pub use convert::{FromProto, TryFromProto};
131-
132129
pub mod protobuf {
133130
pub use datafusion_proto_common::common::proto_error;
134131
pub use datafusion_proto_common::protobuf_common::{

0 commit comments

Comments
 (0)