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

Ankit Aggarwal commented on ARROW-229:
--------------------------------------

Hi Wes

I have created a gist for this
"https://gist.github.com/AnkitAggarwalPEC/7b13e51952f89ac826ea240d0e44b610";

There is a couple of design issue that I'm facing:

1) When the data type is same. I thought it would be better to use directly 
"SetData" function but it is declared as protected, so It cannot be called. By 
making it public it solves the issue.
2) When the data type is not same, I'm trying to use the MakeBuilder function 
to get the required data type builder and use the Append function accordingly 
but Append is not declared in the base class of Array Builder. Should we change 
that or try an another way?

Ankit

> [C++] Implement safe casts for primitive types
> ----------------------------------------------
>
>                 Key: ARROW-229
>                 URL: https://issues.apache.org/jira/browse/ARROW-229
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++
>            Reporter: Uwe L. Korn
>             Fix For: 0.7.0
>
>
> In some situations, you want to cast the data in a PrimitiveArray to a 
> different (but similar) data type, e.g. from {{uint32_t}} to {{int32_t}} or 
> {{uint32_t}} to {{uint8_t}}. This can either be done by reinterpreting the 
> data or needs to involve a copy if the size of the underlying type changes. 
> There is already an implementation for this in {{parquet-cpp}} that could be 
> pulled out into Arrow: 
> https://github.com/apache/parquet-cpp/blob/9a0407e684c0a6299d0e6ab98c11c1162915c0ee/src/parquet/arrow/writer.cc#L71



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to