osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Access Gandiva filter result by array index


Hi Ravindra,

On Fri, Dec 14, 2018 at 01:11:02PM +0530, Ravindra Pindikura wrote:
> > 
> >   But I can't access the elements of the selection vector!  Since it is declared
> >   as std::shared_ptr<arrow::Array>, the Value(..) method isn't found.  I had
> >   filled it with SelectionVector::MakeInt16(..), so I tried downcasting to
> >   arrow::NumericArray<Int16Type>, but that fails!
> 
> This should work:
> 
>   auto array = std::dynamic_pointer_cast<arrow::NumericArray<arrow::UInt16Type>>(selected->ToArray());
>   printf("%d %d\n", array->Value(0), array->Value(1));

Silly of me to not try the unsigned type in the first place!  Thanks a lot :)

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.