Skip to content

Commit

Permalink
Merge pull request #9 from taiyang-li/raw_orc_reader
Browse files Browse the repository at this point in the history
Add interface to get raw orc reader from adapters

(cherry picked from commit ce6b7af)
  • Loading branch information
Avogar authored and nikitamikhaylov committed Oct 15, 2024
1 parent fb031b0 commit 21a89cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cpp/src/arrow/adapters/orc/adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ class ORCFileReader::Impl {
return Init();
}

virtual liborc::Reader* GetRawORCReader() {
return reader_.get();
}


Status Init() {
int64_t nstripes = reader_->getNumberOfStripes();
stripes_.resize(static_cast<size_t>(nstripes));
Expand Down Expand Up @@ -548,6 +553,10 @@ class ORCFileReader::Impl {
return NextStripeReader(batch_size, empty_vec);
}

liborc::Reader* ORCFileReader::GetRawORCReader() {
return impl_->GetRawORCReader();
}

private:
MemoryPool* pool_;
std::unique_ptr<liborc::Reader> reader_;
Expand Down
13 changes: 13 additions & 0 deletions cpp/src/arrow/adapters/orc/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ class ARROW_EXPORT ORCFileReader {
public:
~ORCFileReader();

/// \brief Creates a new ORC reader.
///
/// \param[in] file the data source
/// \param[in] pool a MemoryPool to use for buffer allocations
/// \param[out] reader the returned reader object
/// \return Status
ARROW_DEPRECATED("Deprecated in 6.0.0. Use Result-returning overload instead.")
static Status Open(const std::shared_ptr<io::RandomAccessFile>& file, MemoryPool* pool,
std::unique_ptr<ORCFileReader>* reader);

/// \brief Get ORC reader from inside.
liborc::Reader* GetRawORCReader();

/// \brief Creates a new ORC reader
///
/// \param[in] file the data source
Expand Down

0 comments on commit 21a89cf

Please sign in to comment.