Skip to content

Commit 783d5ad

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 8a101e5 commit 783d5ad

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
@@ -47,24 +47,6 @@ macro_rules! convert_required {
4747
}};
4848
}
4949

50-
/// Like [`convert_required`] but for types whose proto conversion goes through
51-
/// the [`TryFromProto`](crate::convert::TryFromProto) trait instead of
52-
/// [`TryFrom`]. Required because some prost-generated types now live in a
53-
/// separate crate, so `TryFrom`/`From` cannot be implemented on foreign-foreign
54-
/// pairs from `datafusion-proto` directly.
55-
#[macro_export]
56-
macro_rules! convert_required_proto {
57-
($T:ty, $PB:expr) => {{
58-
if let Some(field) = $PB.as_ref() {
59-
Ok::<$T, _>(<$T as $crate::convert::TryFromProto<_>>::try_from_proto(
60-
field,
61-
)?)
62-
} else {
63-
Err(proto_error("Missing required field in protobuf"))
64-
}
65-
}};
66-
}
67-
6850
#[macro_export]
6951
macro_rules! into_required {
7052
($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)