[
https://issues.apache.org/jira/browse/ARROW-9432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17407753#comment-17407753
]
Eduardo Ponce edited comment on ARROW-9432 at 9/1/21, 2:02 AM:
---------------------------------------------------------------
I think the core issue here is to support in a consistent manner, non-negative
indices across compute kernels.
Given that there are multiple kernels that
"behave-different-on-negative-indices" and there are different semantics of
what a negative index entails, this can be handled in Arrow C++ by having a
utility function with an option to dictate on how to interpret negative indices
and always resolve to a set of nonnegative indices. For kernels that have index
parameters and where negative indices are meaningful, we could have an option
to specify the desired behavior and set the default value based on the
language's semantics. These kernels would then resolve the negative indices
before processing any data.
The drawback from this approach is having an additional (non-familiar) option
for these kernels, so maybe resolving the negative indices in the particular
language bindings might be a better choice.
was (Author: edponce):
Given that there are multiple kernels that
"behave-different-on-negative-indices" and there are different semantics of
what a negative index entails, this can be handled in Arrow C++ by having a
utility function with an option to dictate on how to interpret negative indices
and always resolve to a set of nonnegative indices. For kernels that have index
parameters and where negative indices are meaningful, we could have an option
to specify the desired behavior and set the default value based on the
language's semantics. These kernels would then resolve the negative indices
before processing any data.
The drawback from this approach is having an additional (non-familiar) option
for these kernels, so maybe resolving the negative indices in the particular
language bindings might be a better choice.
> [C++/Python] Add option to Take kernel to interpret negative indices as
> indexing from the right
> -----------------------------------------------------------------------------------------------
>
> Key: ARROW-9432
> URL: https://issues.apache.org/jira/browse/ARROW-9432
> Project: Apache Arrow
> Issue Type: New Feature
> Components: C++, Python
> Reporter: Uwe Korn
> Priority: Major
> Fix For: 6.0.0
>
>
> Currently negative integers are explicitly forbidding in the {{Take}} kernel.
> It would be nice to have the option to treat negative integers as "indices
> from the right" instead.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)