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

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhztheplayer committed Apr 12, 2022
1 parent 72cab70 commit 4cead0e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions native-sql-engine/cpp/src/codegen/arrow_compute/ext/sort_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1283,9 +1283,39 @@ class SortOnekeyKernel : public SortArraysToIndicesKernel::Impl {
RETURN_NOT_OK(key_projector_->Evaluate(*in_batch, ctx_->memory_pool(), &outputs));
cached_key_.push_back(std::make_shared<ArrayType_key>(outputs[0]));
nulls_total_ += outputs[0]->null_count();
#ifdef DEBUG
int debug_nulls_count = 0;
for (int i = 0; i < outputs[0]->length(); i++) {
if (outputs[0]->IsNull(i)) {
debug_nulls_count++;
}
}
int64_t nulls_count = outputs[0]->null_count();
if (nulls_count != debug_nulls_count) {
std::cout << "Unexpected Sort Evaluate state, nulls_count: " << nulls_count
<< ", debug_nulls_count: " << debug_nulls_count << std::endl;
std::flush(std::cout);
raise(SIGABRT);
}
#endif
cache_size_total_ += GetArrayVectorSize(outputs);
} else {
nulls_total_ += in[key_id_]->null_count();
#ifdef DEBUG
int debug_nulls_count = 0;
for (int i = 0; i < in[key_id_]->length(); i++) {
if (in[key_id_]->IsNull(i)) {
debug_nulls_count++;
}
}
int64_t nulls_count = in[key_id_]->null_count();
if (nulls_count != debug_nulls_count) {
std::cout << "Unexpected Sort Evaluate state, nulls_count: " << nulls_count
<< ", debug_nulls_count: " << debug_nulls_count << std::endl;
std::flush(std::cout);
raise(SIGABRT);
}
#endif
cached_key_.push_back(std::make_shared<ArrayType_key>(in[key_id_]));
}

Expand Down

0 comments on commit 4cead0e

Please sign in to comment.