tustvold commented on code in PR #5428:
URL: https://github.com/apache/arrow-rs/pull/5428#discussion_r1502043575


##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -1093,20 +1093,33 @@ where
 impl<T: ArrowPrimitiveType> std::fmt::Debug for PrimitiveArray<T> {
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
         let data_type = self.data_type();
+
         write!(f, "PrimitiveArray<{data_type:?}>\n[\n")?;
         print_long_array(self, f, |array, index, f| match data_type {
             DataType::Date32 | DataType::Date64 => {
                 let v = self.value(index).to_isize().unwrap() as i64;
                 match as_date::<T>(v) {
                     Some(date) => write!(f, "{date:?}"),
-                    None => write!(f, "null"),
+                    None => {
+                        let err = ArrowError::CastError(format!(
+                            "Failed to convert {} to temporal for {:?}",
+                            v, data_type
+                        ));
+                        write!(f, "{}", err)

Review Comment:
   ```suggestion
                           write!(
                               "Cast error: Failed to convert {} to temporal 
for {:?}",
                               v, data_type
                           );
   ```



##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -1093,20 +1093,33 @@ where
 impl<T: ArrowPrimitiveType> std::fmt::Debug for PrimitiveArray<T> {
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
         let data_type = self.data_type();
+
         write!(f, "PrimitiveArray<{data_type:?}>\n[\n")?;
         print_long_array(self, f, |array, index, f| match data_type {
             DataType::Date32 | DataType::Date64 => {
                 let v = self.value(index).to_isize().unwrap() as i64;
                 match as_date::<T>(v) {
                     Some(date) => write!(f, "{date:?}"),
-                    None => write!(f, "null"),
+                    None => {
+                        let err = ArrowError::CastError(format!(
+                            "Failed to convert {} to temporal for {:?}",
+                            v, data_type
+                        ));
+                        write!(f, "{}", err)
+                    }
                 }
             }
             DataType::Time32(_) | DataType::Time64(_) => {
                 let v = self.value(index).to_isize().unwrap() as i64;
                 match as_time::<T>(v) {
                     Some(time) => write!(f, "{time:?}"),
-                    None => write!(f, "null"),
+                    None => {
+                        let err = ArrowError::CastError(format!(
+                            "Failed to convert {} to temporal for {:?}",
+                            v, data_type
+                        ));
+                        write!(f, "{}", err)

Review Comment:
   ```suggestion
                           write!(
                               "Cast error: Failed to convert {} to temporal 
for {:?}",
                               v, data_type
                           );
   ```



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