Skip to content

Commit da99206

Browse files
authored
fix: return error instead of panic when decoding ParquetScan/AvroScan without features (apache#24198)
## Which issue does this PR close? - Closes apache#24197. ## Rationale for this change Explained in apache#24197. ## What changes are included in this PR? I just replaced the three feature-gate `panic!`s in `datafusion/proto/src/physical_plan/mod.rs` with `not_impl_err!`, following the existing `ParquetSink` convention in the same file. Also fixes "a Avro" to "an Avro" in the message. ## Are these changes tested? Checked the same feature combinations as the `datafusion-proto features` CI job and ran `cargo test -p datafusion-proto`. Manually verified with a no-default-features build that decoding panicked before and returns `NotImplemented` after. No regression test added because the error path only exists in feature-disabled builds, which CI only runs `cargo check` on. ## Are there any user-facing changes? No API changes.
1 parent 33f3688 commit da99206

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • datafusion/proto/src/physical_plan

‎datafusion/proto/src/physical_plan/mod.rs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,8 +1082,8 @@ pub trait PhysicalPlanNodeExt: Sized {
10821082
ParquetSource::try_from_proto(self.node(), &decode_ctx)
10831083
}
10841084
#[cfg(not(feature = "parquet"))]
1085-
panic!(
1086-
"Unable to process a Parquet PhysicalPlan when `parquet` feature is not enabled"
1085+
not_impl_err!(
1086+
"Unable to process a Parquet PhysicalPlan when the `parquet` feature is not enabled"
10871087
)
10881088
}
10891089
PhysicalPlanType::AvroScan(_) => {
@@ -1418,8 +1418,8 @@ pub trait PhysicalPlanNodeExt: Sized {
14181418
}
14191419

14201420
#[cfg(not(feature = "parquet"))]
1421-
panic!(
1422-
"Unable to process a Parquet PhysicalPlan when `parquet` feature is not enabled"
1421+
not_impl_err!(
1422+
"Unable to process a Parquet PhysicalPlan when the `parquet` feature is not enabled"
14231423
)
14241424
}
14251425

@@ -1448,7 +1448,9 @@ pub trait PhysicalPlanNodeExt: Sized {
14481448
}
14491449

14501450
#[cfg(not(feature = "avro"))]
1451-
panic!("Unable to process a Avro PhysicalPlan when `avro` feature is not enabled")
1451+
not_impl_err!(
1452+
"Unable to process an Avro PhysicalPlan when the `avro` feature is not enabled"
1453+
)
14521454
}
14531455

14541456
#[deprecated(

0 commit comments

Comments
 (0)