Skip to content

Commit

Permalink
fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangHuiGui committed Jun 13, 2024
1 parent 0470f4b commit 5e2207d
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions cpp/src/arrow/compute/exec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ void ComputeDataPreallocate(const DataType& type,
return;
case Type::LIST_VIEW: {
// add offsets and size
widths->emplace_back(32, /*added_length=*/1);
widths->emplace_back(32, /*added_length=*/1);
widths->emplace_back(32);
widths->emplace_back(32);
return;
}
case Type::LARGE_BINARY:
Expand All @@ -310,8 +310,8 @@ void ComputeDataPreallocate(const DataType& type,
return;
case Type::LARGE_LIST_VIEW: {
// add offsets and size
widths->emplace_back(64, /*added_length=*/1);
widths->emplace_back(64, /*added_length=*/1);
widths->emplace_back(64);
widths->emplace_back(64);
return;
}
default:
Expand Down Expand Up @@ -485,7 +485,7 @@ bool ExecSpanIterator::Next(ExecSpan* span) {
namespace {

struct NullGeneralization {
enum type { PERHAPS_NULL = 1, ALL_VALID = 2, ALL_NULL = 3 };
enum type { PERHAPS_NULL = 0, ALL_VALID = 1, ALL_NULL = 2 };

static type Get(const ExecValue& value) {
const auto dtype_id = value.type()->id();
Expand All @@ -511,19 +511,22 @@ struct NullGeneralization {
}

static type Get(const ChunkedArray& chunk_array) {
if (chunk_array.num_chunks() == 0 ||
(chunk_array.null_count() == chunk_array.length())) {
if (chunk_array.num_chunks() == 0) {
return ALL_VALID;
}
if (chunk_array.null_count() == chunk_array.length()) {
return ALL_NULL;
}

type null_gen = ALL_NULL;
int chunk_idx = 0;
while (chunk_idx < chunk_array.num_chunks()) {
type null_gen = ALL_VALID;
for (const auto& chunk : chunk_array.chunks()) {
ExecValue value;
const ArrayData* curr_chunk = chunk_array.chunk(chunk_idx)->data().get();
value.SetArray(*curr_chunk);
null_gen = static_cast<type>((null_gen & Get(value)));
chunk_idx++;
value.SetArray(*chunk->data());
auto null_gen = Get(value);
if (null_gen == ALL_NULL || PERHAPS_NULL) {
null_gen = PERHAPS_NULL;
break;
}
}
return null_gen;
}
Expand Down Expand Up @@ -771,6 +774,7 @@ class KernelExecutorImpl : public KernelExecutor {
}
for (size_t i = 0; i < data_preallocated_.size(); ++i) {
const auto& prealloc = data_preallocated_[i];
DCHECK(prealloc.bit_width >= 0);
ARROW_ASSIGN_OR_RAISE(
out->buffers[i + 1],
AllocateDataBuffer(kernel_ctx_, length + prealloc.added_length,
Expand Down

0 comments on commit 5e2207d

Please sign in to comment.