HaoYang670 commented on code in PR #2181:
URL: https://github.com/apache/arrow-rs/pull/2181#discussion_r930862409


##########
arrow/src/array/array_string.rs:
##########
@@ -313,6 +313,27 @@ impl<'a, OffsetSize: OffsetSizeTrait> ArrayAccessor
     }
 }
 
+impl<OffsetSize: OffsetSizeTrait> From<GenericListArray<OffsetSize>>
+    for GenericStringArray<OffsetSize>
+{
+    fn from(v: GenericListArray<OffsetSize>) -> Self {
+        GenericStringArray::<OffsetSize>::from_list(v)
+    }
+}
+
+impl<OffsetSize: OffsetSizeTrait> From<GenericBinaryArray<OffsetSize>>
+    for GenericStringArray<OffsetSize>
+{
+    fn from(v: GenericBinaryArray<OffsetSize>) -> Self {

Review Comment:
   You are right. But this should not be done in this PR. Because it follows 
the style of the 
current`StringArray::from_list`(https://github.com/apache/arrow-rs/blob/master/arrow/src/array/array_string.rs#L122-L143)
 which is also unsafe.
   
   We could file a follow-up issue to track this. Maybe implementing both 
`safe` and `unsafe` styles is a good choice:
   ```rust
   impl StringArray {
       unsafe fn from_list_unchecked(...) {...}
       unsafe fn from_binary_unchecked (...) {...}
   }
   
   impl From<ListArray> for StringArray {
       /// safe method with utf-8 checking
       fn from(...) {...}
   }
   
   impl From<BinaryArray> for StringArray {
       /// safe method with utf-8 checking
       fn from(...) {...}
   }



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