Skip to content

Commit f1eece9

Browse files
authored
GH-34547: [C++][ORC] Remove deprecated ORC_UNIQUE_PTR (#34548)
### Rationale for this change `ORC_UNIQUE_PTR` is used to wrap `std::auto_ptr` and `std::unique_ptr` before wide adoption of C++11 in the Apache ORC C++ library. Now the library has adopted C++17 already and this macro has been deprecated. ### What changes are included in this PR? Replace `ORC_UNIQUE_PTR` with `std::unique_ptr`. ### Are these changes tested? Make sure all tests pass. ### Are there any user-facing changes? No. * Closes: #34547 Authored-by: Gang Wu <ustcwg@gmail.com> Signed-off-by: Will Jones <willjones127@gmail.com>
1 parent eaa3100 commit f1eece9

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

cpp/src/arrow/adapters/orc/adapter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ class ORCFileWriter::Impl {
781781
std::unique_ptr<liborc::OutputStream> out_stream_;
782782
std::shared_ptr<Schema> arrow_schema_;
783783
WriteOptions write_options_;
784-
ORC_UNIQUE_PTR<liborc::Type> orc_schema_;
784+
std::unique_ptr<liborc::Type> orc_schema_;
785785
};
786786

787787
ORCFileWriter::~ORCFileWriter() {}

cpp/src/arrow/adapters/orc/adapter_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ std::unique_ptr<liborc::Writer> CreateWriter(uint64_t stripe_size,
341341

342342
TEST(TestAdapterRead, ReadIntAndStringFileMultipleStripes) {
343343
MemoryOutputStream mem_stream(kDefaultMemStreamSize);
344-
ORC_UNIQUE_PTR<liborc::Type> type(
344+
std::unique_ptr<liborc::Type> type(
345345
liborc::Type::buildTypeFromString("struct<col1:int,col2:string>"));
346346

347347
constexpr uint64_t stripe_size = 1024; // 1K

cpp/src/arrow/adapters/orc/util.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "arrow/util/string.h"
3535
#include "arrow/visit_data_inline.h"
3636

37-
#include "orc/Exceptions.hh"
3837
#include "orc/MemoryPool.hh"
3938
#include "orc/OrcFile.hh"
4039

@@ -966,10 +965,9 @@ Status WriteBatch(const Array& array, int64_t orc_offset,
966965
array.type()->ToString());
967966
}
968967
}
969-
return Status::OK();
970968
}
971969

972-
Result<ORC_UNIQUE_PTR<liborc::Type>> GetOrcType(const DataType& type) {
970+
Result<std::unique_ptr<liborc::Type>> GetOrcType(const DataType& type) {
973971
Type::type kind = type.id();
974972
switch (kind) {
975973
case Type::type::BOOL:
@@ -1015,7 +1013,7 @@ Result<ORC_UNIQUE_PTR<liborc::Type>> GetOrcType(const DataType& type) {
10151013
return liborc::createListType(std::move(orc_subtype));
10161014
}
10171015
case Type::type::STRUCT: {
1018-
ORC_UNIQUE_PTR<liborc::Type> out_type = liborc::createStructType();
1016+
std::unique_ptr<liborc::Type> out_type = liborc::createStructType();
10191017
std::vector<std::shared_ptr<Field>> arrow_fields =
10201018
checked_cast<const StructType&>(type).fields();
10211019
for (auto it = arrow_fields.begin(); it != arrow_fields.end(); ++it) {
@@ -1037,7 +1035,7 @@ Result<ORC_UNIQUE_PTR<liborc::Type>> GetOrcType(const DataType& type) {
10371035
}
10381036
case Type::type::DENSE_UNION:
10391037
case Type::type::SPARSE_UNION: {
1040-
ORC_UNIQUE_PTR<liborc::Type> out_type = liborc::createUnionType();
1038+
std::unique_ptr<liborc::Type> out_type = liborc::createUnionType();
10411039
std::vector<std::shared_ptr<Field>> arrow_fields =
10421040
checked_cast<const UnionType&>(type).fields();
10431041
for (const auto& arrow_field : arrow_fields) {
@@ -1167,9 +1165,9 @@ Result<std::shared_ptr<DataType>> GetArrowType(const liborc::Type* type) {
11671165
}
11681166
}
11691167

1170-
Result<ORC_UNIQUE_PTR<liborc::Type>> GetOrcType(const Schema& schema) {
1168+
Result<std::unique_ptr<liborc::Type>> GetOrcType(const Schema& schema) {
11711169
int numFields = schema.num_fields();
1172-
ORC_UNIQUE_PTR<liborc::Type> out_type = liborc::createStructType();
1170+
std::unique_ptr<liborc::Type> out_type = liborc::createStructType();
11731171
for (int i = 0; i < numFields; i++) {
11741172
const auto& field = schema.field(i);
11751173
ARROW_ASSIGN_OR_RAISE(auto orc_subtype, GetOrcType(*field->type()));

cpp/src/arrow/adapters/orc/util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace orc {
3333

3434
Result<std::shared_ptr<DataType>> GetArrowType(const liborc::Type* type);
3535

36-
Result<ORC_UNIQUE_PTR<liborc::Type>> GetOrcType(const Schema& schema);
36+
Result<std::unique_ptr<liborc::Type>> GetOrcType(const Schema& schema);
3737

3838
ARROW_EXPORT Status AppendBatch(const liborc::Type* type,
3939
liborc::ColumnVectorBatch* batch, int64_t offset,

0 commit comments

Comments
 (0)