From fc5cb3399ecf9070d623a35be83dbbee9fe7a687 Mon Sep 17 00:00:00 2001 From: Chendi Xue Date: Fri, 22 Jan 2021 13:13:10 +0800 Subject: [PATCH] split w/wo repeated api for sort and join Signed-off-by: Chendi Xue --- .../arrow_compute/ext/array_appender.h | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/cpp/src/codegen/arrow_compute/ext/array_appender.h b/cpp/src/codegen/arrow_compute/ext/array_appender.h index 13773a300..e13ae010f 100644 --- a/cpp/src/codegen/arrow_compute/ext/array_appender.h +++ b/cpp/src/codegen/arrow_compute/ext/array_appender.h @@ -23,7 +23,6 @@ #include #include "codegen/arrow_compute/ext/array_item_index.h" -#include "utils/macros.h" namespace sparkcolumnarplugin { namespace codegen { @@ -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."); } @@ -107,6 +110,15 @@ class ArrayAppender> : 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(); @@ -182,6 +194,15 @@ class ArrayAppender> 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(); @@ -255,6 +276,15 @@ class ArrayAppender> : 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();