Skip to content

[C++][Python][Compute] String hex to numeric conversion and bit shifting #18653

@asfimport

Description

@asfimport

Hi Apache Arrow Community,

thanks for the great work on this project - it is really a game changer. I've started to use it more frequently since more and more compute kernels became available.

However, I have a current requirement which I can't fulfill, yet. More concretely, I have hex values as strings. I need to convert them to numeric type (int) and apply bit shifting.

Currently, I can't find a way to do so. I tried type casts (string to int) like 

import pyarrow as pa

array = pa.array(["0x2001591", "0x2000848", "0x2000123"])
array.cast(pa.uint32())

However this results in ArrowInvalid: Failed to parse string: '0x2000123' as a scalar of type uint32. 

Moreover, I will need to apply bit shifting once converted. I'm not sure if there is anything comparable in the compute kernels, yet.

Thanks for any help in advance.
 
 

Reporter: Franz
Assignee: William Malpica / @wmalpica

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-12657. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions