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

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Zhou <[email protected]>
  • Loading branch information
zhouyuan committed Aug 15, 2022
1 parent 62c7d68 commit dd30765
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ class CountAction : public ActionBase {
template <typename DataType>
class CountDistinctAction : public ActionBase {
public:
CountDistinctAction(arrow::compute::ExecContext* ctx, int arg) : ctx_(ctx), localGid_(arg) {
CountDistinctAction(arrow::compute::ExecContext* ctx, int arg)
: ctx_(ctx), localGid_(arg) {
#ifdef DEBUG
std::cout << "Construct CountDistinctAction" << std::endl;
#endif
Expand All @@ -463,9 +464,7 @@ class CountDistinctAction : public ActionBase {
std::cout << "Destruct CountDistinctAction" << std::endl;
#endif
}
std::string getName() {
return "CountDistinctAction";
}
std::string getName() { return "CountDistinctAction"; }
arrow::Status Submit(ArrayList in_list, int max_group_id,
std::function<arrow::Status(int)>* on_valid,
std::function<arrow::Status()>* on_null) override {
Expand Down Expand Up @@ -510,7 +509,7 @@ class CountDistinctAction : public ActionBase {
cache_.resize(1, 0);
length_ = 1;
}
//at least two arrays, count attrs and gid
// at least two arrays, count attrs and gid
assert(in.size() > 1);
int gid = in.size() - 1;
auto gidArray = const_cast<int32_t*>(in[gid]->data()->GetValues<int32_t>(1));
Expand All @@ -519,7 +518,7 @@ class CountDistinctAction : public ActionBase {
int count_null = 0;
for (size_t id = 0; id < length; id++) {
for (int colId = 0; colId < in.size() - 1; colId++) {
if (in[colId]->IsNull(id) || gidArray[id] != localGid_) {
if (gidArray[id] == 0 || in[colId]->IsNull(id)) {
count_null++;
break;
}
Expand Down Expand Up @@ -583,6 +582,7 @@ class CountDistinctAction : public ActionBase {
using ResBuilderType = typename arrow::TypeTraits<DataType>::BuilderType;
// input
arrow::compute::ExecContext* ctx_;
// for debug only
int32_t localGid_ = -1;
// result
using CType = typename arrow::TypeTraits<DataType>::CType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ class HashAggregateKernel::Impl {
std::shared_ptr<GandivaProjector> pre_process_projector;
if (!prepare_function_list_.empty()) {
#ifdef DEBUG
std::cout << "gandiva schema: " << arrow::schema(input_field_list_)->ToString() << std::endl;
std::cout << "gandiva schema: " << arrow::schema(input_field_list_)->ToString()
<< std::endl;
#endif
auto pre_process_expr_list = GetGandivaKernel(prepare_function_list_);
pre_process_projector = std::make_shared<GandivaProjector>(
Expand Down Expand Up @@ -829,7 +830,7 @@ class HashAggregateKernel::Impl {
// literal
RETURN_NOT_OK(action->EvaluateCountLiteral(in[0]->length()));

} else if (action->getName() == "CountDistinctAction") {
} else if (action->getName() == "CountDistinctAction") {
RETURN_NOT_OK(action->EvaluateCountDistinct(cols));
} else {
RETURN_NOT_OK(action->Evaluate(cols));
Expand Down

0 comments on commit dd30765

Please sign in to comment.