[ https://issues.apache.org/jira/browse/ARROW-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17035562#comment-17035562 ]
Jacek Pliszka commented on ARROW-3329: -------------------------------------- The key question is whether CastFunctor in cast.cc has access to scale of the decimal? If yes how? If not - these are the options I've came up with: Let's assume Decimal128Type value is n Then I expect that base call .cast('int64') will return overflow for n beyond int64 values, value otherwise Option 1: .cast('int64', decimal_scale=s) would calculate n/10**s and return overflow if it is beyond int64, value otherwise Option 2: .cast('int64', bytes_group=0) would return n & 0x00000000FFFFFFFF .cast('int64', bytes_group=1) would return (n >> 64) & 0x00000000FFFFFFFF .cast('int64') would have default value bytes_group=0 Option 3: cast has no CastOptions but we add multiply compute kernel and have something like this instead: .compute('multiply', 10**-s).cast('int64') > [Python] Error casting decimal(38, 4) to int64 > ---------------------------------------------- > > Key: ARROW-3329 > URL: https://issues.apache.org/jira/browse/ARROW-3329 > Project: Apache Arrow > Issue Type: Bug > Components: Python > Environment: Python version : 3.6.5 > Pyarrow version : 0.10.0 > Reporter: Kavita Sheth > Priority: Major > > Git issue LInk : https://github.com/apache/arrow/issues/2627 > I want to cast pyarrow table column from decimal(38,4) to int64. > col.cast(pa.int64()) > Error: > File "pyarrow/table.pxi", line 443, in pyarrow.lib.Column.cast > File "pyarrow/error.pxi", line 89, in pyarrow.lib.check_status > pyarrow.lib.ArrowNotImplementedError: No cast implemented from decimal(38, > 4) to int64 > Python version : 3.6.5 > Pyarrow version : 0.10.0 > is it not implemented yet or I am not using it correctly? If not implemented > yet, then any work around to cast columns? -- This message was sent by Atlassian Jira (v8.3.4#803005)