|
15 | 15 | // specific language governing permissions and limitations |
16 | 16 | // under the License. |
17 | 17 |
|
| 18 | +#include <iostream> |
18 | 19 | #include <limits> |
19 | 20 | #include <optional> |
20 | 21 |
|
21 | 22 | #include "arrow/array/array_base.h" |
22 | 23 | #include "arrow/array/builder_binary.h" |
| 24 | +#include "arrow/buffer.h" |
23 | 25 | #include "arrow/compute/kernels/base_arithmetic_internal.h" |
24 | 26 | #include "arrow/compute/kernels/codegen_internal.h" |
25 | 27 | #include "arrow/compute/kernels/common_internal.h" |
26 | 28 | #include "arrow/compute/kernels/scalar_cast_internal.h" |
27 | 29 | #include "arrow/compute/kernels/temporal_internal.h" |
28 | 30 | #include "arrow/result.h" |
| 31 | +#include "arrow/testing/gtest_util.h" |
29 | 32 | #include "arrow/type.h" |
30 | 33 | #include "arrow/type_traits.h" |
31 | 34 | #include "arrow/util/formatting.h" |
@@ -304,8 +307,18 @@ BinaryToBinaryCastExec(KernelContext* ctx, const ExecSpan& batch, ExecResult* ou |
304 | 307 | } |
305 | 308 | } |
306 | 309 |
|
307 | | - // Start with a zero-copy cast, but change indices to expected size |
308 | | - RETURN_NOT_OK(ZeroCopyCastExec(ctx, batch, out)); |
| 310 | + std::shared_ptr<ArrayData> input_arr = input.ToArrayData(); |
| 311 | + ArrayData* output = out->array_data().get(); |
| 312 | + output->length = input_arr->length; |
| 313 | + output->offset = input_arr->offset % 8; |
| 314 | + output->buffers = input_arr->buffers; |
| 315 | + output->child_data = input_arr->child_data; |
| 316 | + output->SetNullCount(input_arr->null_count); |
| 317 | + |
| 318 | + if (output->buffers[0]) { |
| 319 | + output->buffers[0] = SliceBuffer(input_arr->buffers[0], input_arr->offset / 8); |
| 320 | + } |
| 321 | + |
309 | 322 | return CastBinaryToBinaryOffsets<typename I::offset_type, typename O::offset_type>( |
310 | 323 | ctx, input, out->array_data().get()); |
311 | 324 | } |
|
0 commit comments