This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new ce4edd5320 Some panic!s could more semantically be unimplemented! 
(#8933)
ce4edd5320 is described below

commit ce4edd53203eb4bca96c10ebf3d2118299dad006
Author: Mark Nash <[email protected]>
AuthorDate: Thu Dec 4 08:48:07 2025 -0800

    Some panic!s could more semantically be unimplemented! (#8933)
    
    # Which issue does this PR close?
    
    We generally require a GitHub issue to be filed for all bug fixes and
    enhancements and this helps us generate change logs for our releases.
    You can link an issue to this PR using the GitHub syntax.
    
    - Closes #8932 .
    
    # Rationale for this change
    
    Why are you proposing this change? If this is already explained clearly
    in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand
    your changes and offer better suggestions for fixes.
    
    Some `panic!` conversions
    
    There is no need to duplicate the description in the issue here but it
    is sometimes worth providing a summary of the individual changes in this
    PR.
    
    # Are these changes tested?
    
    We typically require tests for all PRs in order to:
    1. Prevent the code from being accidentally broken by subsequent changes
    2. Serve as another way to document the expected behavior of the code
    
    Not sure these panic test cases are covered
    
    # Are there any user-facing changes?
    
    N/A
---
 arrow-array/src/array/mod.rs   | 6 +++---
 arrow-array/src/builder/mod.rs | 8 +++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arrow-array/src/array/mod.rs b/arrow-array/src/array/mod.rs
index 5ece2457c6..2581e5ce4d 100644
--- a/arrow-array/src/array/mod.rs
+++ b/arrow-array/src/array/mod.rs
@@ -824,20 +824,20 @@ pub fn make_array(data: ArrayData) -> ArrayRef {
             DataType::UInt16 => 
Arc::new(DictionaryArray::<UInt16Type>::from(data)) as ArrayRef,
             DataType::UInt32 => 
Arc::new(DictionaryArray::<UInt32Type>::from(data)) as ArrayRef,
             DataType::UInt64 => 
Arc::new(DictionaryArray::<UInt64Type>::from(data)) as ArrayRef,
-            dt => panic!("Unexpected dictionary key type {dt}"),
+            dt => unimplemented!("Unexpected dictionary key type {dt}"),
         },
         DataType::RunEndEncoded(run_ends_type, _) => match 
run_ends_type.data_type() {
             DataType::Int16 => Arc::new(RunArray::<Int16Type>::from(data)) as 
ArrayRef,
             DataType::Int32 => Arc::new(RunArray::<Int32Type>::from(data)) as 
ArrayRef,
             DataType::Int64 => Arc::new(RunArray::<Int64Type>::from(data)) as 
ArrayRef,
-            dt => panic!("Unexpected data type for run_ends array {dt}"),
+            dt => unimplemented!("Unexpected data type for run_ends array 
{dt}"),
         },
         DataType::Null => Arc::new(NullArray::from(data)) as ArrayRef,
         DataType::Decimal32(_, _) => Arc::new(Decimal32Array::from(data)) as 
ArrayRef,
         DataType::Decimal64(_, _) => Arc::new(Decimal64Array::from(data)) as 
ArrayRef,
         DataType::Decimal128(_, _) => Arc::new(Decimal128Array::from(data)) as 
ArrayRef,
         DataType::Decimal256(_, _) => Arc::new(Decimal256Array::from(data)) as 
ArrayRef,
-        dt => panic!("Unexpected data type {dt}"),
+        dt => unimplemented!("Unexpected data type {dt}"),
     }
 }
 
diff --git a/arrow-array/src/builder/mod.rs b/arrow-array/src/builder/mod.rs
index 0ce3149296..02c6df453b 100644
--- a/arrow-array/src/builder/mod.rs
+++ b/arrow-array/src/builder/mod.rs
@@ -594,7 +594,7 @@ pub fn make_builder(datatype: &DataType, capacity: usize) 
-> Box<dyn ArrayBuilde
                                 
LargeBinaryDictionaryBuilder::with_capacity(capacity, 256, 1024);
                             Box::new(dict_builder)
                         }
-                        t => panic!("Dictionary value type {t} is not 
currently supported"),
+                        t => unimplemented!("Dictionary value type {t} is not 
currently supported"),
                     }
                 };
             }
@@ -604,10 +604,12 @@ pub fn make_builder(datatype: &DataType, capacity: usize) 
-> Box<dyn ArrayBuilde
                 DataType::Int32 => dict_builder!(Int32Type),
                 DataType::Int64 => dict_builder!(Int64Type),
                 _ => {
-                    panic!("Data type {t} with key type {key_type} is not 
currently supported")
+                    unimplemented!(
+                        "Data type {t} with key type {key_type} is not 
currently supported"
+                    )
                 }
             }
         }
-        t => panic!("Data type {t} is not currently supported"),
+        t => unimplemented!("Data type {t} is not currently supported"),
     }
 }

Reply via email to