Jefffrey commented on code in PR #3450:
URL: https://github.com/apache/arrow-rs/pull/3450#discussion_r1061127939


##########
arrow-array/src/array/map_array.rs:
##########
@@ -110,11 +110,12 @@ impl From<MapArray> for ArrayData {
 
 impl MapArray {
     fn try_new_from_array_data(data: ArrayData) -> Result<Self, ArrowError> {
-        assert!(
-            matches!(data.data_type(), DataType::Map(_, _)),
-            "MapArray expected ArrayData with DataType::Map got {}",
-            data.data_type()
-        );
+        if !matches!(data.data_type(), DataType::Map(_, _)) {
+            return Err(ArrowError::InvalidArgumentError(format!(
+                "MapArray expected ArrayData with DataType::Map got {}",
+                data.data_type()
+            )));
+        }

Review Comment:
   refactoring out a panic into an Err



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

Reply via email to