Jefffrey commented on code in PR #18790:
URL: https://github.com/apache/datafusion/pull/18790#discussion_r2535955364


##########
datafusion/proto/src/logical_plan/mod.rs:
##########
@@ -776,11 +776,10 @@ impl AsLogicalPlan for LogicalPlanNode {
                 builder.build()
             }
             LogicalPlanType::Union(union) => {
-                if union.inputs.len() < 2 {
-                    return internal_err!(
-                        "Protobuf deserialization error, Union was require at 
least two input."
-                    );
-                }
+                assert_or_internal_err!(
+                    union.inputs.len() >= 2,
+                    "Protobuf deserialization error, Union was require at 
least two input."
+                );

Review Comment:
   This should technically be an exec error I guess?



##########
datafusion/common/src/scalar/mod.rs:
##########
@@ -1729,14 +1714,15 @@ impl ScalarValue {
             DataType::Float32 => ScalarValue::Float32(Some(10.0)),
             DataType::Float64 => ScalarValue::Float64(Some(10.0)),
             DataType::Decimal32(precision, scale) => {
-                if let Err(err) = 
validate_decimal_precision_and_scale::<Decimal32Type>(
+                let validation = 
validate_decimal_precision_and_scale::<Decimal32Type>(
                     *precision, *scale,
-                ) {
-                    return _internal_err!("Invalid precision and scale {err}");
-                }
-                if *scale < 0 {
-                    return _internal_err!("Negative scale is not supported");
-                }
+                );
+                assert_or_internal_err!(
+                    validation.is_ok(),
+                    "Invalid precision and scale {}",
+                    validation.unwrap_err()
+                );

Review Comment:
   Seems more appropriate to do a map_err here? (Same for below)



-- 
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]

Reply via email to