[
https://issues.apache.org/jira/browse/ARROW-11871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17297668#comment-17297668
]
ARF commented on ARROW-11871:
-----------------------------
[~jorisvandenbossche] Thanks for your explanations. I accept that in end this
depends on the semantics of {{null}}. Two different programmers can
legitimately understand {{null}} to mean different things. How a programmer
understands {{null}} dictates the correct behaviour of {{power()}}.
A programmer that understands {{null}} in an array to mean "this is a value of
the defined datatype, I just don't know what it is" will expect {{power(<any
value including any unknown value>, 0) == 1}}.
A programmer that understands {{null}} in an array to mean "this value does not
exist, it is fundamentally invalid" will expect {{power(null, 0) == null}}.
It would seem to me the solution is to leave the choice to the user and allow
her/him to specify the desired behaviour as an option to {{power}}. Then the
debate becomes only "what should the default behaviour be?" ;-) In this case, I
would reverse my opinion and would argue at least for {{pyarrow}} to default to
the python behaviour of {{float('NaN')**0.0 == 1}}.
If arrow has to specify a unique semantic interpretation of {{null}} and cannot
allow user choice, I believe however {{power(null, 0) == null}} is the better
choice due to greater versatility: As I tried to explain in my previous
comment, this interpretation allows to user to obtain the alternative behaviour
by using {{power(fill_null(null, 0), 0) == 1}}.
Conversely if arrow standardized on {{power(null, 0) == 1}} there is nothing
the user can do to get the alternative behaviour. Once a value becomes
non-{{null}}, there is no way to recover its original {{null}}-ness.
Please feel free to close this issue as a duplicate. I searched for issues
relating to {{power}} and did not find ARROW-11070.
> [C++] Add element-wise power() compute function
> -----------------------------------------------
>
> Key: ARROW-11871
> URL: https://issues.apache.org/jira/browse/ARROW-11871
> Project: Apache Arrow
> Issue Type: Improvement
> Components: C++
> Affects Versions: 3.0.0
> Reporter: ARF
> Priority: Minor
>
> It would be nice to have an element-wise {{power()}} compute function.
> I.e. in analogy to
> [numpy.power()|https://numpy.org/doc/stable/reference/generated/numpy.power.html].
--
This message was sent by Atlassian Jira
(v8.3.4#803005)