[ 
https://issues.apache.org/jira/browse/ARROW-8567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17643482#comment-17643482
 ] 

Apache Arrow JIRA Bot commented on ARROW-8567:
----------------------------------------------

This issue was last updated over 90 days ago, which may be an indication it is 
no longer being actively worked. To better reflect the current state, the issue 
is being unassigned per [project 
policy|https://arrow.apache.org/docs/dev/developers/bug_reports.html#issue-assignment].
 Please feel free to re-take assignment of the issue if it is being actively 
worked, or if you plan to start that work soon.

> [Python] pa.array() sometimes ignore "safe=False"
> -------------------------------------------------
>
>                 Key: ARROW-8567
>                 URL: https://issues.apache.org/jira/browse/ARROW-8567
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.17.0
>            Reporter: Antoine Pitrou
>            Assignee: Shoichi Kagawa
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Generally, {{pa.array(data).cast(sometype, safe=...)}} is equivalent to
> {{pa.array(data, sometype, safe=...)}}. Consider the following:
> {code:python}
> >>> pa.array([Decimal('12.34')]).cast(pa.int32(), safe=False)                 
> >>>                                                                           
> >>>                     
> <pyarrow.lib.Int32Array object at 0x7efbbd1556e0>
> [
>   12
> ]
> >>> pa.array([Decimal('12.34')], pa.int32(), safe=False)                      
> >>>                                                                           
> >>>                     
> <pyarrow.lib.Int32Array object at 0x7efbbd13dad0>
> [
>   12
> ]
> {code}
> However, that is not always the case:
> {code:python}
> >>> pa.array([Decimal('1234')]).cast(pa.int8(), safe=False)                   
> >>>                                                                           
> >>>                     
> <pyarrow.lib.Int8Array object at 0x7efbbd18e4b0>
> [
>   -46
> ]
> >>> pa.array([Decimal('1234')], pa.int8(), safe=False)                        
> >>>                                                                           
> >>>                     
> Traceback (most recent call last):
>   ...
> ArrowInvalid: Value 1234 too large to fit in C integer type
> {code}
> I don't think this is very important: first because you can call cast() 
> directly, second because the results are unusable anyway.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to