XiangpengHao commented on code in PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#discussion_r1681091444


##########
arrow-cast/src/cast/string.rs:
##########
@@ -43,17 +44,33 @@ pub(crate) fn parse_string<P: Parser, O: OffsetSizeTrait>(
     cast_options: &CastOptions,
 ) -> Result<ArrayRef, ArrowError> {
     let string_array = array.as_string::<O>();
+    parse_string_iter::<P, _, _>(string_array.iter(), cast_options, || 
string_array.nulls().cloned())
+}
+
+/// Parse UTF-8 View
+pub(crate) fn parse_string_view<P: Parser>(
+    array: &dyn Array,
+    cast_options: &CastOptions,
+) -> Result<ArrayRef, ArrowError> {
+    let string_view_array = array.as_string_view();
+    parse_string_iter::<P, _, _>(string_view_array.iter(), cast_options, || 
string_view_array.nulls().cloned())
+}
+
+fn parse_string_iter<'a, P: Parser, I: Iterator<Item=Option<&'a str>>, F: 
FnOnce() -> Option<NullBuffer>>(

Review Comment:
   Maybe we can use this trait: 
https://github.com/apache/arrow-rs/blob/master/arrow-string/src/like.rs#L158? 
Probably need to make it a public trait first.



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