Skip to content

Commit 0de39f2

Browse files
committed
review feedback
1 parent ab3edb4 commit 0de39f2

3 files changed

Lines changed: 15 additions & 16 deletions

File tree

cpp/src/arrow/extension/tensor_internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818
#pragma once
1919

2020
#include <cstdint>
21-
#include <vector>
22-
2321
#include <span>
22+
#include <vector>
2423

2524
#include "arrow/result.h"
2625
#include "arrow/type_fwd.h"

cpp/src/arrow/extension/variable_shape_tensor.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ Result<std::shared_ptr<Tensor>> VariableShapeTensorType::MakeTensor(
274274

275275
Result<std::shared_ptr<DataType>> VariableShapeTensorType::Make(
276276
const std::shared_ptr<DataType>& value_type, int32_t ndim,
277-
const std::vector<int64_t>& permutation, const std::vector<std::string>& dim_names,
278-
const std::vector<std::optional<int64_t>>& uniform_shape) {
277+
std::vector<int64_t> permutation, std::vector<std::string> dim_names,
278+
std::vector<std::optional<int64_t>> uniform_shape) {
279279
if (!is_fixed_width(*value_type)) {
280280
return Status::Invalid("Cannot convert non-fixed-width values to Tensor.");
281281
}
@@ -306,16 +306,18 @@ Result<std::shared_ptr<DataType>> VariableShapeTensorType::Make(
306306
RETURN_NOT_OK(internal::IsPermutationValid(permutation));
307307
}
308308

309-
return std::make_shared<VariableShapeTensorType>(value_type, ndim, permutation,
310-
dim_names, uniform_shape);
309+
return std::make_shared<VariableShapeTensorType>(
310+
value_type, ndim, std::move(permutation), std::move(dim_names),
311+
std::move(uniform_shape));
311312
}
312313

313314
std::shared_ptr<DataType> variable_shape_tensor(
314315
const std::shared_ptr<DataType>& value_type, int32_t ndim,
315-
const std::vector<int64_t>& permutation, const std::vector<std::string>& dim_names,
316-
const std::vector<std::optional<int64_t>>& uniform_shape) {
317-
auto maybe_type = VariableShapeTensorType::Make(value_type, ndim, permutation,
318-
dim_names, uniform_shape);
316+
std::vector<int64_t> permutation, std::vector<std::string> dim_names,
317+
std::vector<std::optional<int64_t>> uniform_shape) {
318+
auto maybe_type = VariableShapeTensorType::Make(
319+
value_type, ndim, std::move(permutation), std::move(dim_names),
320+
std::move(uniform_shape));
319321
ARROW_CHECK_OK(maybe_type.status());
320322
return maybe_type.MoveValueUnsafe();
321323
}

cpp/src/arrow/extension/variable_shape_tensor.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ class ARROW_EXPORT VariableShapeTensorType : public ExtensionType {
9191
/// \brief Create a VariableShapeTensorType instance
9292
static Result<std::shared_ptr<DataType>> Make(
9393
const std::shared_ptr<DataType>& value_type, int32_t ndim,
94-
const std::vector<int64_t>& permutation = {},
95-
const std::vector<std::string>& dim_names = {},
96-
const std::vector<std::optional<int64_t>>& uniform_shape = {});
94+
std::vector<int64_t> permutation = {}, std::vector<std::string> dim_names = {},
95+
std::vector<std::optional<int64_t>> uniform_shape = {});
9796

9897
private:
9998
std::shared_ptr<DataType> value_type_;
@@ -106,8 +105,7 @@ class ARROW_EXPORT VariableShapeTensorType : public ExtensionType {
106105
/// \brief Return a VariableShapeTensorType instance.
107106
ARROW_EXPORT std::shared_ptr<DataType> variable_shape_tensor(
108107
const std::shared_ptr<DataType>& value_type, int32_t ndim,
109-
const std::vector<int64_t>& permutation = {},
110-
const std::vector<std::string>& dim_names = {},
111-
const std::vector<std::optional<int64_t>>& uniform_shape = {});
108+
std::vector<int64_t> permutation = {}, std::vector<std::string> dim_names = {},
109+
std::vector<std::optional<int64_t>> uniform_shape = {});
112110

113111
} // namespace arrow::extension

0 commit comments

Comments
 (0)