bkietz commented on a change in pull request #9554:
URL: https://github.com/apache/arrow/pull/9554#discussion_r581340233



##########
File path: cpp/src/arrow/compute/kernels/codegen_internal.h
##########
@@ -663,13 +663,14 @@ struct ScalarUnaryNotNullStateful {
     static void Exec(const ThisType& functor, KernelContext* ctx, const 
ArrayData& arg0,
                      Datum* out) {
       ArrayData* out_arr = out->mutable_array();
-      auto out_data = out_arr->GetMutableValues<Decimal128>(1);
+      auto out_data = out_arr->GetMutableValues<uint8_t>(1, 0) + 16 * 
out_arr->offset;

Review comment:
       ```suggestion
         // Data buffers of decimal128 arrays are not safely 
reinterpret_cast-able on bigendian platforms
         using endian_agnostic = std::array<uint8_t, sizeof(Decimal128)>;
         auto out_bytes = out_arr->GetMutableValues<endian_agnostic>(1);
   ```

##########
File path: cpp/src/arrow/compute/kernels/codegen_internal.h
##########
@@ -663,13 +663,14 @@ struct ScalarUnaryNotNullStateful {
     static void Exec(const ThisType& functor, KernelContext* ctx, const 
ArrayData& arg0,
                      Datum* out) {
       ArrayData* out_arr = out->mutable_array();
-      auto out_data = out_arr->GetMutableValues<Decimal128>(1);
+      auto out_data = out_arr->GetMutableValues<uint8_t>(1, 0) + 16 * 
out_arr->offset;
       VisitArrayValuesInline<Arg0Type>(
           arg0,
           [&](Arg0Value v) {
-            *out_data++ = functor.op.template Call<OutValue, Arg0Value>(ctx, 
v);
+            functor.op.template Call<OutValue, Arg0Value>(ctx, 
v).ToBytes(out_data);
+            out_data += 16;

Review comment:
       ```suggestion
               functor.op.template Call<OutValue, Arg0Value>(ctx, 
v).ToBytes(out_bytes++->data());
   ```

##########
File path: cpp/src/arrow/compute/kernels/codegen_internal.h
##########
@@ -663,13 +663,14 @@ struct ScalarUnaryNotNullStateful {
     static void Exec(const ThisType& functor, KernelContext* ctx, const 
ArrayData& arg0,
                      Datum* out) {
       ArrayData* out_arr = out->mutable_array();
-      auto out_data = out_arr->GetMutableValues<Decimal128>(1);
+      auto out_data = out_arr->GetMutableValues<uint8_t>(1, 0) + 16 * 
out_arr->offset;
       VisitArrayValuesInline<Arg0Type>(
           arg0,
           [&](Arg0Value v) {
-            *out_data++ = functor.op.template Call<OutValue, Arg0Value>(ctx, 
v);
+            functor.op.template Call<OutValue, Arg0Value>(ctx, 
v).ToBytes(out_data);
+            out_data += 16;
           },
-          [&]() { ++out_data; });
+          [&]() { out_data += 16; });

Review comment:
       ```suggestion
             [&]() { ++out_bytes; });
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to