You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "rohanjain101 (via GitHub)" <gi...@apache.org> on 2023/04/06 01:35:21 UTC

[GitHub] [arrow] rohanjain101 opened a new issue, #34917: Allow utf8_slice_codeunits to support default start value of None to support strings of different length

rohanjain101 opened a new issue, #34917:
URL: https://github.com/apache/arrow/issues/34917

   ### Describe the enhancement requested
   
   Related to https://github.com/pandas-dev/pandas/issues/52434. Currently utf8_slice_codeunits doesn't support a default start value. It would be nice to support default of 0 if step > 1 and len -1 if step < 0 for parity with pandas.
   
   ### Component(s)
   
   Python


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

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


[GitHub] [arrow] jorisvandenbossche commented on issue #34917: [C++][Python] Allow utf8_slice_codeunits to support default start value of None to support strings of different length

Posted by "jorisvandenbossche (via GitHub)" <gi...@apache.org>.
jorisvandenbossche commented on issue #34917:
URL: https://github.com/apache/arrow/issues/34917#issuecomment-1498964859

   @rohanjain101 thanks for the report! I was going to mention that you could use `sys.maxsize` as start (the largest integer, will always be beyond the end of a single string in the input, and so will always start slicing from the end), but apparently you can easily run into a segfault with that: opened https://github.com/apache/arrow/issues/34928
   
   As a non-ideal workaround, you could check what is the largest string in your input array with `pa.compute.max(pa.compute.utf8_length(arr))` (or just take a reasonable large value, but not close to sys.maxsize), and use that as start value:
   
   ```
   In [1]: pa.compute.utf8_slice_codeunits("abcdefghijklmnabcdefghijkln", start=1000, stop=8, step=-9)
   Out[1]: <pyarrow.StringScalar: 'nd'>
   ```


-- 
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: [I] [C++][Python] Allow utf8_slice_codeunits to support default start value of None to support strings of different length [arrow]

Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic commented on issue #34917:
URL: https://github.com/apache/arrow/issues/34917#issuecomment-3921718664

   This issue has been marked as stale because it has had no activity in the past 2 years. Please remove the stale label or comment below, or this issue will be closed in 14 days.


-- 
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: [I] [C++][Python] Allow utf8_slice_codeunits to support default start value of None to support strings of different length [arrow]

Posted by "thisisnic (via GitHub)" <gi...@apache.org>.
thisisnic closed issue #34917: [C++][Python] Allow utf8_slice_codeunits to support default start value of None to support strings of different length
URL: https://github.com/apache/arrow/issues/34917


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

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