Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
optimize loop
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Feb 8, 2021
1 parent fef825f commit 24d8b68
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions cpp/src/codegen/arrow_compute/ext/sort_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1553,12 +1553,11 @@ class SortOnekeyKernel : public SortArraysToIndicesKernel::Impl {
auto length = (total_length_ - offset_) > batch_size_ ? batch_size_
: (total_length_ - offset_);
uint64_t count = 0;
for (int i = 0; i < col_num_; i++) {
while (count < length) {
auto item = indices_begin_ + offset_ + count++;
while (count < length) {
auto item = indices_begin_ + offset_ + count++;
for (int i = 0; i < col_num_; i++) {
RETURN_NOT_OK(appender_list_[i]->Append(item->array_id, item->id));
}
count = 0;
}
offset_ += length;
ArrayList arrays;
Expand Down Expand Up @@ -1808,12 +1807,11 @@ class SortMultiplekeyKernel : public SortArraysToIndicesKernel::Impl {
auto length = (total_length_ - offset_) > batch_size_ ? batch_size_
: (total_length_ - offset_);
uint64_t count = 0;
for (int i = 0; i < col_num_; i++) {
while (count < length) {
auto item = indices_begin_ + offset_ + count++;
while (count < length) {
auto item = indices_begin_ + offset_ + count++;
for (int i = 0; i < col_num_; i++) {
RETURN_NOT_OK(appender_list_[i]->Append(item->array_id, item->id));
}
count = 0;
}
offset_ += length;
ArrayList arrays;
Expand Down

0 comments on commit 24d8b68

Please sign in to comment.