Skip to content

Commit

Permalink
Trying to fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Feb 20, 2025
1 parent 77c3d37 commit 68fab84
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cpp/src/arrow/compute/kernels/scalar_cast_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ namespace internal {

namespace {

Result<std::shared_ptr<Buffer>> GetNullBitmapBuffer(const ArraySpan& in_array,
MemoryPool* pool) {
Result<std::shared_ptr<Buffer>> GetOrCopyNullBitmapBuffer(const ArraySpan& in_array,
MemoryPool* pool) {
if (in_array.buffers[0].data == nullptr) {
return nullptr;
}
Expand All @@ -56,6 +56,10 @@ Result<std::shared_ptr<Buffer>> GetNullBitmapBuffer(const ArraySpan& in_array,
return in_array.GetBuffer(0);
}

if (in_array.offset % 8 == 0) {
return SliceBuffer(in_array.GetBuffer(0), /*offset=*/in_array.offset / 8);
}

// If a non-zero offset, we need to shift the bitmap
return arrow::internal::CopyBitmap(pool, in_array.buffers[0].data, in_array.offset,
in_array.length);
Expand Down Expand Up @@ -350,7 +354,7 @@ BinaryToBinaryCastExec(KernelContext* ctx, const ExecSpan& batch, ExecResult* ou

// Set up validity bitmap
ARROW_ASSIGN_OR_RAISE(output->buffers[0],
GetNullBitmapBuffer(input, ctx->memory_pool()));
GetOrCopyNullBitmapBuffer(input, ctx->memory_pool()));

// Set up offset and data buffer
OffsetBuilder offset_builder(ctx->memory_pool());
Expand Down

0 comments on commit 68fab84

Please sign in to comment.