Skip to content

Commit

Permalink
Add sessionTimezone and adjustTimestampToTimezone to DWRF reader and …
Browse files Browse the repository at this point in the history
…writer options
  • Loading branch information
wypb committed Sep 24, 2024
1 parent 5ce95a0 commit 65e360e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions velox/dwio/dwrf/reader/ReaderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class ReaderBase {

/// Creates reader base from metadata.
ReaderBase(
const dwio::common::ReaderOptions& options,
memory::MemoryPool& pool,
std::unique_ptr<dwio::common::BufferedInput> input,
std::unique_ptr<PostScript> ps,
const proto::Footer* footer,
std::unique_ptr<StripeMetadataCache> cache,
std::unique_ptr<encryption::DecryptionHandler> handler = nullptr)
: options_{options},
: options_{dwio::common::ReaderOptions(&pool)},
postScript_{std::move(ps)},
footer_{std::make_unique<FooterWrapper>(footer)},
cache_{std::move(cache)},
Expand Down
3 changes: 1 addition & 2 deletions velox/dwio/dwrf/test/ReaderBaseTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ class EncryptedStatsTest : public Test {
auto readFile =
std::make_shared<facebook::velox::InMemoryReadFile>(std::string());
readerPool_ = pool_->addLeafChild("reader");
facebook::velox::dwio::common::ReaderOptions readerOpts{readerPool_.get()};
reader_ = std::make_unique<ReaderBase>(
readerOpts,
*readerPool_,
std::make_unique<BufferedInput>(readFile, *readerPool_),
std::make_unique<PostScript>(std::move(ps)),
footer,
Expand Down
3 changes: 1 addition & 2 deletions velox/dwio/dwrf/test/StripeReaderBaseTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ class StripeLoadKeysTest : public Test {
auto handler =
DecryptionHandler::create(FooterWrapper(footer_.get()), &factory);
pool_ = memoryManager()->addLeafPool();
dwio::common::ReaderOptions readerOpts{pool_.get()};
reader_ = std::make_unique<ReaderBase>(
readerOpts,
*pool_,
std::make_unique<BufferedInput>(
std::make_shared<InMemoryReadFile>(std::string()), *pool_),
nullptr,
Expand Down
18 changes: 6 additions & 12 deletions velox/dwio/dwrf/test/TestStripeStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ TEST_F(StripeStreamTest, planReads) {
ProtoUtils::writeType(*type, *footer);
auto is = std::make_unique<RecordingInputStream>();
auto isPtr = is.get();
facebook::velox::dwio::common::ReaderOptions readerOpts{pool_.get()};
auto readerBase = std::make_shared<ReaderBase>(
readerOpts,
*pool_,
std::make_unique<BufferedInput>(
std::move(is),
*pool_,
Expand Down Expand Up @@ -188,9 +187,8 @@ TEST_F(StripeStreamTest, filterSequences) {
ProtoUtils::writeType(*type, *footer);
auto is = std::make_unique<RecordingInputStream>();
auto isPtr = is.get();
facebook::velox::dwio::common::ReaderOptions readerOpts{pool_.get()};
auto readerBase = std::make_shared<ReaderBase>(
readerOpts,
*pool_,
std::make_unique<BufferedInput>(std::move(is), *pool_),
std::make_unique<PostScript>(proto::PostScript{}),
footer,
Expand Down Expand Up @@ -256,9 +254,8 @@ TEST_F(StripeStreamTest, zeroLength) {
ps.set_compression(proto::CompressionKind::ZSTD);
auto is = std::make_unique<RecordingInputStream>();
auto isPtr = is.get();
facebook::velox::dwio::common::ReaderOptions readerOpts{pool_.get()};
auto readerBase = std::make_shared<ReaderBase>(
readerOpts,
*pool_,
std::make_unique<BufferedInput>(std::move(is), *pool_),
std::make_unique<PostScript>(std::move(ps)),
footer,
Expand Down Expand Up @@ -349,9 +346,8 @@ TEST_F(StripeStreamTest, planReadsIndex) {

auto is = std::make_unique<RecordingInputStream>();
auto isPtr = is.get();
facebook::velox::dwio::common::ReaderOptions readerOpts{pool_.get()};
auto readerBase = std::make_shared<ReaderBase>(
readerOpts,
*pool_,
std::make_unique<BufferedInput>(std::move(is), *pool_),
std::make_unique<PostScript>(std::move(ps)),
footer,
Expand Down Expand Up @@ -481,9 +477,8 @@ TEST_F(StripeStreamTest, readEncryptedStreams) {
*stripeFooter->add_encryptiongroups() = "";

auto readerPool = pool->addLeafChild("reader");
facebook::velox::dwio::common::ReaderOptions readerOpts{pool_.get()};
auto readerBase = std::make_shared<ReaderBase>(
readerOpts,
*readerPool,
std::make_unique<BufferedInput>(
std::make_shared<facebook::velox::InMemoryReadFile>(std::string()),
*readerPool),
Expand Down Expand Up @@ -564,10 +559,9 @@ TEST_F(StripeStreamTest, schemaMismatch) {
encrypter.setKey("key");
pw.writeProto(*stripeFooter->add_encryptiongroups(), group, encrypter);

facebook::velox::dwio::common::ReaderOptions readerOpts{pool_.get()};
auto readerPool = pool->addLeafChild("reader");
auto readerBase = std::make_shared<ReaderBase>(
readerOpts,
*readerPool,
std::make_unique<BufferedInput>(
std::make_shared<facebook::velox::InMemoryReadFile>(std::string()),
*pool_),
Expand Down

0 comments on commit 65e360e

Please sign in to comment.