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

Commit

Permalink
split w/wo repeated api for sort and join
Browse files Browse the repository at this point in the history
Signed-off-by: Chendi Xue <[email protected]>
  • Loading branch information
xuechendi committed Jan 22, 2021
1 parent dfa59f8 commit fc5cb33
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions cpp/src/codegen/arrow_compute/ext/array_appender.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <vector>

#include "codegen/arrow_compute/ext/array_item_index.h"
#include "utils/macros.h"

namespace sparkcolumnarplugin {
namespace codegen {
Expand All @@ -45,8 +44,12 @@ class AppenderBase {
return arrow::Status::NotImplemented("AppenderBase PopArray is abstract.");
}

virtual arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id) {
return arrow::Status::NotImplemented("AppenderBase Append is abstract.");
}

virtual arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id,
int repeated = 1) {
int repeated) {
return arrow::Status::NotImplemented("AppenderBase Append is abstract.");
}

Expand Down Expand Up @@ -107,6 +110,15 @@ class ArrayAppender<DataType, enable_if_number_or_date<DataType>> : public Appen
return arrow::Status::OK();
}

arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id) override {
if (has_null_ && cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
RETURN_NOT_OK(builder_->Append(cached_arr_[array_id]->GetView(item_id)));
}
return arrow::Status::OK();
}

arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id,
int repeated) override {
if (repeated == 0) return arrow::Status::OK();
Expand Down Expand Up @@ -182,6 +194,15 @@ class ArrayAppender<DataType, arrow::enable_if_string_like<DataType>>
return arrow::Status::OK();
}

arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id) override {
if (has_null_ && cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
RETURN_NOT_OK(builder_->Append(cached_arr_[array_id]->GetView(item_id)));
}
return arrow::Status::OK();
}

arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id,
int repeated) override {
if (repeated == 0) return arrow::Status::OK();
Expand Down Expand Up @@ -255,6 +276,15 @@ class ArrayAppender<DataType, arrow::enable_if_boolean<DataType>> : public Appen
return arrow::Status::OK();
}

arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id) override {
if (has_null_ && cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
RETURN_NOT_OK(builder_->Append(cached_arr_[array_id]->GetView(item_id)));
}
return arrow::Status::OK();
}

arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id,
int repeated) override {
if (repeated == 0) return arrow::Status::OK();
Expand Down

0 comments on commit fc5cb33

Please sign in to comment.