Skip to content

Commit

Permalink
Make visit method public and remove friend
Browse files Browse the repository at this point in the history
  • Loading branch information
zanmato1984 committed Dec 11, 2024
1 parent 2d09a8e commit b0c52e8
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions cpp/src/arrow/compute/kernels/vector_swizzle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,6 @@ struct InversePermutationImpl {
{std::move(impl.validity_buf), std::move(impl.data_buf)});
}

private:
KernelContext* ctx;
const ShapeType& indices;
const int64_t input_length;
const int64_t output_length;

std::shared_ptr<Buffer> validity_buf = nullptr;
std::shared_ptr<Buffer> data_buf = nullptr;

private:
InversePermutationImpl(KernelContext* ctx, const ShapeType& indices,
int64_t input_length, int64_t output_length)
: ctx(ctx),
indices(indices),
input_length(input_length),
output_length(output_length) {}

Status Visit(const DataType& output_type) {
DCHECK(false) << "Shouldn't reach here";
return Status::Invalid("Shouldn't reach here");
}

template <typename Type>
enable_if_t<is_integer_type<Type>::value, Status> Visit(const Type& output_type) {
using OutputCType = typename Type::c_type;
Expand All @@ -136,6 +114,27 @@ struct InversePermutationImpl {
}
}

Status Visit(const DataType& output_type) {
DCHECK(false) << "Shouldn't reach here";
return Status::Invalid("Shouldn't reach here");
}

private:
KernelContext* ctx;
const ShapeType& indices;
const int64_t input_length;
const int64_t output_length;

std::shared_ptr<Buffer> validity_buf = nullptr;
std::shared_ptr<Buffer> data_buf = nullptr;

InversePermutationImpl(KernelContext* ctx, const ShapeType& indices,
int64_t input_length, int64_t output_length)
: ctx(ctx),
indices(indices),
input_length(input_length),
output_length(output_length) {}

template <typename Type>
Status CheckInput(const Type& output_type) {
using OutputCType = typename Type::c_type;
Expand Down Expand Up @@ -235,9 +234,6 @@ struct InversePermutationImpl {

return Status::OK();
}

template <typename VISITOR, typename... ARGS>
friend Status arrow::VisitTypeInline(const DataType&, VISITOR*, ARGS&&... args);
};

template <typename Ignored, typename Type>
Expand Down

0 comments on commit b0c52e8

Please sign in to comment.