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

Panchen Xue edited comment on ARROW-1757 at 1/26/18 11:42 PM:
--------------------------------------------------------------

A question. Suppose we have the API
{code:java}
Status DictionaryArray::FromArrays(const std::shared_ptr<Array>& indices,
                                   const std::shared_ptr<DataType>& type);
{code}
We need to check every element of *indices* to see if each one is valid. In 
order to do this we need to cast the *indices* to its actual type to access its 
data
{code:java}
std::shared_ptr<SOME_TYPE> raw_array = 
std::static_pointer_cast<SOME_TYPE>(indices);
{code}
The *indices* in principle may have any integer type (signed or unsigned) and 
we can get type info from *indices->data()->type* but how can I convert to 
*SOME_TYPE* (like Int32Array) to create the correct raw array?


was (Author: 1xuepanchen1):
A question. Suppose we have the API
{code}
Status DictionaryArray::FromArrays(const std::shared_ptr<Array>& indices,
                                   const std::shared_ptr<DataType>& type);
{code}
We need to check every element of *indices* to see if each one is valid. In 
order to do this we need to cast the array to its actual type to access its data
{code}
std::shared_ptr<SOME_TYPE> raw_array = 
std::static_pointer_cast<SOME_TYPE>(indices);
{code}
The *indices* in principle may have any integer type (signed or unsigned) and 
we can get type info from *indices->data()->type* but how can I convert to 
static *SOME_TYPE* (like Int32Array) to create the correct raw array?

> [C++] Add DictionaryArray::FromArrays alternate ctor that can check or 
> sanitized "untrusted" indices
> ----------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-1757
>                 URL: https://issues.apache.org/jira/browse/ARROW-1757
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++
>            Reporter: Wes McKinney
>            Priority: Major
>             Fix For: 0.9.0
>
>
> Related to ARROW-1658. This is related to the offset sanitization in 
> {{ListArray::FromArrays}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to