You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Jacek Pliszka (Jira)" <ji...@apache.org> on 2020/04/24 07:42:00 UTC

[jira] [Commented] (ARROW-8568) [C++][Python] Crash on decimal cast in debug mode

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

Jacek Pliszka commented on ARROW-8568:
--------------------------------------

The problem is here:

```
{color:#267f99}DecimalStatus{color} {color:#267f99}BasicDecimal128{color}{color:#000000}::{color}{color:#795e26}Rescale{color}{color:#000000}({color}{color:#0000ff}int32_t{color} {color:#001080}original_scale{color}{color:#000000}, {color}{color:#0000ff}int32_t{color} {color:#001080}new_scale{color}{color:#000000},{color}
{color:#267f99}BasicDecimal128{color}{color:#0000ff}*{color} {color:#001080}out{color}{color:#000000}) {color}{color:#0000ff}const{color}{color:#000000} {{color}
{color:#795e26}DCHECK_NE{color}{color:#000000}(out, {color}{color:#0000ff}nullptr{color}{color:#000000});{color}
{color:#795e26}DCHECK_NE{color}{color:#000000}(original_scale, new_scale);{color}
```

Firstly there is design question - should calling Rescale with original_scale == new_scale be allowed ?

 

If not - I can fix it in my code somewhere. But IMHO Rescale should allow for that and should handle data overflow then.

> [C++][Python] Crash on decimal cast in debug mode
> -------------------------------------------------
>
>                 Key: ARROW-8568
>                 URL: https://issues.apache.org/jira/browse/ARROW-8568
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++, Python
>    Affects Versions: 0.17.0
>            Reporter: Antoine Pitrou
>            Priority: Major
>
> {code:python}
> >>> arr = pa.array([Decimal('123.45')])                                                                                                                                   
> >>> arr                                                                                                                                                                   
> <pyarrow.lib.Decimal128Array object at 0x7efbbddd4210>
> [
>   123.45
> ]
> >>> arr.type                                                                                                                                                              
> Decimal128Type(decimal(5, 2))
> >>> arr.cast(pa.decimal128(4, 2))                                                                                                                                         
> ../src/arrow/util/basic_decimal.cc:626:  Check failed: (original_scale) != (new_scale) 
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)