This is an automated email from the ASF dual-hosted git repository.
xudong963 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new 128217081c Minor: simplify code in datafusion-proto (#15752)
128217081c is described below
commit 128217081ca922c404fe423c3c1b945662d53c8a
Author: Andrew Lamb <[email protected]>
AuthorDate: Thu Apr 17 21:31:55 2025 -0400
Minor: simplify code in datafusion-proto (#15752)
---
datafusion/proto-common/src/common.rs | 1 +
datafusion/proto/src/logical_plan/mod.rs | 7 ++-----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/datafusion/proto-common/src/common.rs
b/datafusion/proto-common/src/common.rs
index 61711dcf8e..9af63e3b07 100644
--- a/datafusion/proto-common/src/common.rs
+++ b/datafusion/proto-common/src/common.rs
@@ -17,6 +17,7 @@
use datafusion_common::{internal_datafusion_err, DataFusionError};
+/// Return a `DataFusionError::Internal` with the given message
pub fn proto_error<S: Into<String>>(message: S) -> DataFusionError {
internal_datafusion_err!("{}", message.into())
}
diff --git a/datafusion/proto/src/logical_plan/mod.rs
b/datafusion/proto/src/logical_plan/mod.rs
index 806f604ccc..a39e6dac37 100644
--- a/datafusion/proto/src/logical_plan/mod.rs
+++ b/datafusion/proto/src/logical_plan/mod.rs
@@ -355,10 +355,7 @@ impl AsLogicalPlan for LogicalPlanNode {
.as_ref()
.map(|expr| from_proto::parse_expr(expr, ctx,
extension_codec))
.transpose()?
- .ok_or_else(|| {
- DataFusionError::Internal("expression
required".to_string())
- })?;
- // .try_into()?;
+ .ok_or_else(|| proto_error("expression required"))?;
LogicalPlanBuilder::from(input).filter(expr)?.build()
}
LogicalPlanType::Window(window) => {
@@ -464,7 +461,7 @@ impl AsLogicalPlan for LogicalPlanNode {
.map(|col| {
let Some(arrow_type) = col.arrow_type.as_ref() else {
return Err(proto_error(
- "Missing Arrow type in partition
columns".to_string(),
+ "Missing Arrow type in partition columns",
));
};
let arrow_type =
DataType::try_from(arrow_type).map_err(|e| {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]