Skip to content

Commit

Permalink
Merge bc6e977 into 203c1cc
Browse files Browse the repository at this point in the history
  • Loading branch information
dorooleg authored Jun 4, 2024
2 parents 203c1cc + bc6e977 commit 2109a27
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ydb/library/yql/providers/s3/compressors/zstd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@ TReadBuffer::TReadBuffer(NDB::ReadBuffer& source)
InBuffer.resize(8_KB);
OutBuffer.resize(64_KB);
Offset_ = InBuffer.size();
Size_ = InBuffer.size();
}

TReadBuffer::~TReadBuffer() {
::ZSTD_freeDStream(ZCtx_);
}

bool TReadBuffer::nextImpl() {
::ZSTD_inBuffer zIn{InBuffer.data(), InBuffer.size(), Offset_};
::ZSTD_inBuffer zIn{InBuffer.data(), Size_, Offset_};
::ZSTD_outBuffer zOut{OutBuffer.data(), OutBuffer.size(), 0ULL};

size_t returnCode = 0ULL;
if (!Finished_) do {
if (zIn.pos == zIn.size) {
zIn.size = Source_.read(InBuffer.data(), InBuffer.size());
Size_ = zIn.size;

zIn.pos = Offset_ = 0;
if (!zIn.size) {
Expand Down
3 changes: 2 additions & 1 deletion ydb/library/yql/providers/s3/compressors/zstd.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class TReadBuffer : public NDB::ReadBuffer {
NDB::ReadBuffer& Source_;
std::vector<char> InBuffer, OutBuffer;
::ZSTD_DStream *const ZCtx_;
size_t Offset_;
size_t Offset_;
size_t Size_;
bool Finished_ = false;
};

Expand Down

0 comments on commit 2109a27

Please sign in to comment.