diff --git a/cpp/src/arrow/compute/kernels/ntake.cc b/cpp/src/arrow/compute/kernels/ntake.cc index a11fb2995b1fd..61544192d3431 100644 --- a/cpp/src/arrow/compute/kernels/ntake.cc +++ b/cpp/src/arrow/compute/kernels/ntake.cc @@ -36,7 +36,7 @@ class NTakeKernelImpl : public NTakeKernel { : NTakeKernel(value_type) {} Status Init() { - return Taker>::Make(this->type_, &taker_); + return NTaker>::Make(this->type_, &taker_); } Status NTake(FunctionContext* ctx, const Array& values, const Array& indices_array, @@ -46,10 +46,10 @@ class NTakeKernelImpl : public NTakeKernel { return taker_->Finish(out); } - std::unique_ptr>> taker_; + std::unique_ptr>> taker_; }; -struct UnpackIndices { +struct NUnpackIndices { template enable_if_integer Visit(const IndexType&) { auto out = new NTakeKernelImpl(value_type_); @@ -68,7 +68,7 @@ struct UnpackIndices { Status NTakeKernel::Make(const std::shared_ptr& value_type, const std::shared_ptr& index_type, std::unique_ptr* out) { - UnpackIndices visitor{value_type, out}; + NUnpackIndices visitor{value_type, out}; return VisitTypeInline(*index_type, &visitor); } diff --git a/cpp/src/arrow/compute/kernels/ntake_internal.h b/cpp/src/arrow/compute/kernels/ntake_internal.h index 35b7f3e472030..bf2e5dce2b293 100644 --- a/cpp/src/arrow/compute/kernels/ntake_internal.h +++ b/cpp/src/arrow/compute/kernels/ntake_internal.h @@ -120,17 +120,17 @@ Status VisitIndices(IndexSequence indices, const Array& values, Visitor&& vis) { // Helper class for gathering values from an array template -class Taker { +class NTaker { public: - explicit Taker(const std::shared_ptr& type) : type_(type) {} + explicit NTaker(const std::shared_ptr& type) : type_(type) {} - virtual ~Taker() = default; + virtual ~NTaker() = default; // initialize this taker including constructing any children, // must be called once after construction before any other methods are called virtual Status Init() { return Status::OK(); } - // reset this Taker and set FunctionContext for taking an array + // reset this NTaker and set FunctionContext for taking an array // must be called each time the FunctionContext may have changed virtual Status SetContext(FunctionContext* ctx) = 0; @@ -140,8 +140,8 @@ class Taker { // assemble an array of all gathered values virtual Status Finish(std::shared_ptr*) = 0; - // factory; the output Taker will support gathering values of the given type - static Status Make(const std::shared_ptr& type, std::unique_ptr* out); + // factory; the output NTaker will support gathering values of the given type + static Status Make(const std::shared_ptr& type, std::unique_ptr* out); static_assert(std::is_literal_type::value, "Index sequences must be literal type"); @@ -240,12 +240,12 @@ class ArrayIndexSequence { // the array supports array.GetView() and the corresponding builder supports // builder.UnsafeAppend(array.GetView()) template -class TakerImpl : public Taker { +class NTakerImpl : public NTaker { public: using ArrayType = typename TypeTraits::ArrayType; using BuilderType = typename TypeTraits::BuilderType; - using Taker::Taker; + using NTaker::NTaker; Status SetContext(FunctionContext* ctx) override { return this->MakeBuilder(ctx->memory_pool(), &builder_); @@ -273,9 +273,9 @@ class TakerImpl : public Taker { // Gathering from NullArrays is trivial; skip the builder and just // do bounds checking template -class TakerImpl : public Taker { +class NTakerImpl : public NTaker { public: - using Taker::Taker; + using NTaker::NTaker; Status SetContext(FunctionContext*) override { return Status::OK(); } @@ -301,16 +301,16 @@ class TakerImpl : public Taker { }; template -class ListTakerImpl : public Taker { +class ListNTakerImpl : public NTaker { public: using offset_type = typename TypeClass::offset_type; using ArrayType = typename TypeTraits::ArrayType; - using Taker::Taker; + using NTaker::NTaker; Status Init() override { const auto& list_type = checked_cast(*this->type_); - return Taker::Make(list_type.value_type(), &value_taker_); + return NTaker::Make(list_type.value_type(), &value_taker_); } Status SetContext(FunctionContext* ctx) override { @@ -363,33 +363,33 @@ class ListTakerImpl : public Taker { std::unique_ptr> null_bitmap_builder_; std::unique_ptr> offset_builder_; - std::unique_ptr> value_taker_; + std::unique_ptr> value_taker_; }; template -class TakerImpl : public ListTakerImpl { - using ListTakerImpl::ListTakerImpl; +class NTakerImpl : public ListNTakerImpl { + using ListNTakerImpl::ListNTakerImpl; }; template -class TakerImpl - : public ListTakerImpl { - using ListTakerImpl::ListTakerImpl; +class NTakerImpl + : public ListNTakerImpl { + using ListNTakerImpl::ListNTakerImpl; }; template -class TakerImpl : public ListTakerImpl { - using ListTakerImpl::ListTakerImpl; +class NTakerImpl : public ListNTakerImpl { + using ListNTakerImpl::ListNTakerImpl; }; template -class TakerImpl : public Taker { +class NTakerImpl : public NTaker { public: - using Taker::Taker; + using NTaker::NTaker; Status Init() override { const auto& list_type = checked_cast(*this->type_); - return Taker::Make(list_type.value_type(), &value_taker_); + return NTaker::Make(list_type.value_type(), &value_taker_); } Status SetContext(FunctionContext* ctx) override { @@ -433,19 +433,19 @@ class TakerImpl : public Taker protected: std::unique_ptr> null_bitmap_builder_; - std::unique_ptr> value_taker_; + std::unique_ptr> value_taker_; }; template -class TakerImpl : public Taker { +class NTakerImpl : public NTaker { public: - using Taker::Taker; + using NTaker::NTaker; Status Init() override { children_.resize(this->type_->num_children()); for (int i = 0; i < this->type_->num_children(); ++i) { RETURN_NOT_OK( - Taker::Make(this->type_->child(i)->type(), &children_[i])); + NTaker::Make(this->type_->child(i)->type(), &children_[i])); } return Status::OK(); } @@ -495,13 +495,13 @@ class TakerImpl : public Taker { protected: std::unique_ptr> null_bitmap_builder_; - std::vector>> children_; + std::vector>> children_; }; template -class TakerImpl : public Taker { +class NTakerImpl : public NTaker { public: - using Taker::Taker; + using NTaker::NTaker; Status Init() override { union_type_ = checked_cast(this->type_.get()); @@ -515,10 +515,10 @@ class TakerImpl : public Taker { for (int i = 0; i < this->type_->num_children(); ++i) { if (union_type_->mode() == UnionMode::SPARSE) { - RETURN_NOT_OK(Taker::Make(this->type_->child(i)->type(), + RETURN_NOT_OK(NTaker::Make(this->type_->child(i)->type(), &sparse_children_[i])); } else { - RETURN_NOT_OK(Taker>::Make( + RETURN_NOT_OK(NTaker>::Make( this->type_->child(i)->type(), &dense_children_[i])); } } @@ -668,20 +668,20 @@ class TakerImpl : public Taker { std::unique_ptr> null_bitmap_builder_; std::unique_ptr> type_id_builder_; std::unique_ptr> offset_builder_; - std::vector>> sparse_children_; - std::vector>>> dense_children_; + std::vector>> sparse_children_; + std::vector>>> dense_children_; std::vector child_length_; }; // taking from a DictionaryArray is accomplished by taking from its indices template -class TakerImpl : public Taker { +class NTakerImpl : public NTaker { public: - using Taker::Taker; + using NTaker::NTaker; Status Init() override { const auto& dict_type = checked_cast(*this->type_); - return Taker::Make(dict_type.index_type(), &index_taker_); + return NTaker::Make(dict_type.index_type(), &index_taker_); } Status SetContext(FunctionContext* ctx) override { @@ -711,18 +711,18 @@ class TakerImpl : public Taker { protected: std::shared_ptr dictionary_; - std::unique_ptr> index_taker_; + std::unique_ptr> index_taker_; }; // taking from an ExtensionArray is accomplished by taking from its storage template -class TakerImpl : public Taker { +class NTakerImpl : public NTaker { public: - using Taker::Taker; + using NTaker::NTaker; Status Init() override { const auto& ext_type = checked_cast(*this->type_); - return Taker::Make(ext_type.storage_type(), &storage_taker_); + return NTaker::Make(ext_type.storage_type(), &storage_taker_); } Status SetContext(FunctionContext* ctx) override { @@ -743,25 +743,25 @@ class TakerImpl : public Taker { } protected: - std::unique_ptr> storage_taker_; + std::unique_ptr> storage_taker_; }; template -struct TakerMakeImpl { +struct NTakerMakeImpl { template Status Visit(const T&) { - out_->reset(new TakerImpl(type_)); + out_->reset(new NTakerImpl(type_)); return (*out_)->Init(); } std::shared_ptr type_; - std::unique_ptr>* out_; + std::unique_ptr>* out_; }; template -Status Taker::Make(const std::shared_ptr& type, - std::unique_ptr* out) { - TakerMakeImpl visitor{type, out}; +Status NTaker::Make(const std::shared_ptr& type, + std::unique_ptr* out) { + NTakerMakeImpl visitor{type, out}; return VisitTypeInline(*type, &visitor); }