You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "a10y (via GitHub)" <gi...@apache.org> on 2024/07/17 13:37:02 UTC

[PR] Enable casting from Utf8View [arrow-rs]

a10y opened a new pull request, #6077:
URL: https://github.com/apache/arrow-rs/pull/6077

   # 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. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #6076 
   
   # Rationale for this change
    
   See issue
   
   # What changes are included in this PR?
   
   Mirroring of the existing Utf8 cast operations for Utf8View
   
   # Are there any user-facing changes?
   
   Purely additive, this adds functionality for users that have Utf8View columns.
   
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "a10y (via GitHub)" <gi...@apache.org>.
a10y commented on code in PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#discussion_r1681073235


##########
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:
   wanted to extract out the common functionality, could also be a macro if preferred



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "a10y (via GitHub)" <gi...@apache.org>.
a10y commented on PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#issuecomment-2236893664

   This is ready for review, I've run `cargo test -p arrow-cast` locally and everything passes


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#issuecomment-2239938983

   > Hm, I'm not sure what's up with the archery test, I'm seeing some connection denied after 10 minutes, I don't have permission to retrigger the check but I'm wondering if it's possibly a flake?
   
   Yes, I think it was a flake. Also once we have merged this PR I think your subsequent PRs will automatically start CI so we should be able to reduce the turnaround time on future PRs


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#issuecomment-2239966259

   Thanks again @a10y 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "a10y (via GitHub)" <gi...@apache.org>.
a10y commented on PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#issuecomment-2240093347

   Thanks for the quick reviews!


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#issuecomment-2240170350

   > Thanks for the quick reviews!
   
   Well, I am not sure I would call 2 days a quick review. One of my goals over the next few months is to grow the reviewer capacity in arrow-rs .


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "XiangpengHao (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "a10y (via GitHub)" <gi...@apache.org>.
a10y commented on PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077#issuecomment-2237731191

   Hm, I'm not sure what's up with the archery test, I'm seeing some connection denied after 10 minutes, I don't have permission to retrigger the check but I'm wondering if it's possibly a flake? 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Enable casting from Utf8View [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6077:
URL: https://github.com/apache/arrow-rs/pull/6077


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org