Re: [C++] Recommended way to extract values from scalars

2024-02-19 Thread Weston Pace
There is no advantage to using a Datum here. The Datum class is mainly intended for representing something that might be a Scalar or might be an Array. > Also, is there an efficient way to loop through a slice perhaps by incrementing a pointer? You will want to cast the Array and avoid Scalar

Re: [C++] Recommended way to extract values from scalars

2024-02-19 Thread Blair Azzopardi
On 2nd thoughts, the 2nd method could also be done in a single line. auto low3 = arrow::Datum(st_s_low.ValueOrDie()).scalar_as().value; That said, I'm still keen to hear if there's an advantage to using Datum or without; and on my 2nd question regarding efficiently looping through a slice's

[C++] Recommended way to extract values from scalars

2024-02-19 Thread Blair Azzopardi
Hi I'm trying to figure out the optimal way for extracting scalar values from a table; I've found two ways, using a dynamic cast or using Datum and cast. Is one better than the other? The advantage of the dynamic cast, seems at least, to be a one liner. auto c_val1 =