diff --git a/velox/dwio/dwrf/reader/ReaderBase.cpp b/velox/dwio/dwrf/reader/ReaderBase.cpp index f90291726c6e..249669b764a0 100644 --- a/velox/dwio/dwrf/reader/ReaderBase.cpp +++ b/velox/dwio/dwrf/reader/ReaderBase.cpp @@ -76,6 +76,12 @@ FooterStatisticsImpl::FooterStatisticsImpl( } } +ReaderBase::ReaderBase( + MemoryPool& pool, + std::unique_ptr input, + FileFormat fileFormat) + : ReaderBase(createReaderOptions(pool, fileFormat), std::move(input)) {} + ReaderBase::ReaderBase( const dwio::common::ReaderOptions& options, std::unique_ptr input) diff --git a/velox/dwio/dwrf/reader/ReaderBase.h b/velox/dwio/dwrf/reader/ReaderBase.h index 8e5b3387f37e..3d8a5bdbc344 100644 --- a/velox/dwio/dwrf/reader/ReaderBase.h +++ b/velox/dwio/dwrf/reader/ReaderBase.h @@ -65,6 +65,13 @@ class ReaderBase { const dwio::common::ReaderOptions& options, std::unique_ptr input); + /// Creates reader base from buffered input. + /// It is kept here for backward compatibility with Meta's internal usage. + ReaderBase( + memory::MemoryPool& pool, + std::unique_ptr input, + dwio::common::FileFormat fileFormat); + /// Creates reader base from metadata. ReaderBase( memory::MemoryPool& pool, @@ -245,6 +252,14 @@ class ReaderBase { uint32_t index = 0, bool fileColumnNamesReadAsLowerCase = false); + static dwio::common::ReaderOptions createReaderOptions( + memory::MemoryPool& pool, + dwio::common::FileFormat fileFormat) { + dwio::common::ReaderOptions options(&pool); + options.setFileFormat(fileFormat); + return options; + } + const dwio::common::ReaderOptions options_; std::unique_ptr arena_; std::unique_ptr postScript_;