Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jinchengchenghh committed Dec 13, 2024
1 parent 871a42f commit 11a55b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions velox/serializers/CompactRowSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ using TRowSize = uint32_t;

class CompactRowVectorSerializer : public RowSerializer<row::CompactRow> {
public:
explicit CompactRowVectorSerializer(StreamArena* streamArena)
: RowSerializer<row::CompactRow>(streamArena) {}
explicit CompactRowVectorSerializer(memory::MemoryPool* pool)
: RowSerializer<row::CompactRow>(pool) {}

private:
void serializeRanges(
Expand Down Expand Up @@ -75,7 +75,7 @@ CompactRowVectorSerde::createIterativeSerializer(
int32_t /* numRows */,
StreamArena* streamArena,
const Options* /* options */) {
return std::make_unique<CompactRowVectorSerializer>(streamArena);
return std::make_unique<CompactRowVectorSerializer>(streamArena->pool());
}

void CompactRowVectorSerde::deserialize(
Expand Down
10 changes: 5 additions & 5 deletions velox/serializers/RowSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ using TRowSize = uint32_t;
template <class Serializer>
class RowSerializer : public IterativeVectorSerializer {
public:
explicit RowSerializer(StreamArena* streamArena)
: pool_{streamArena->pool()} {}
explicit RowSerializer(memory::MemoryPool* pool) : pool_(pool) {}

void append(
const RowVectorPtr& vector,
Expand Down Expand Up @@ -118,15 +117,16 @@ class RowSerializer : public IterativeVectorSerializer {

protected:
virtual void serializeRanges(
const Serializer& row,
const Serializer& rowSerializer,
const folly::Range<const IndexRange*>& ranges,
char* rawBuffer,
const std::vector<vector_size_t>& /*rowSize*/) {
size_t offset = 0;
for (auto& range : ranges) {
for (auto i = range.begin; i < range.begin + range.size; ++i) {
for (auto row = range.begin; row < range.begin + range.size; ++row) {
// Write row data.
TRowSize size = row.serialize(i, rawBuffer + offset + sizeof(TRowSize));
TRowSize size =
rowSerializer.serialize(row, rawBuffer + offset + sizeof(TRowSize));

// Write raw size. Needs to be in big endian order.
*(TRowSize*)(rawBuffer + offset) = folly::Endian::big(size);
Expand Down
3 changes: 2 additions & 1 deletion velox/serializers/UnsafeRowSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ UnsafeRowVectorSerde::createIterativeSerializer(
int32_t /* numRows */,
StreamArena* streamArena,
const Options* /* options */) {
return std::make_unique<RowSerializer<row::UnsafeRowFast>>(streamArena);
return std::make_unique<RowSerializer<row::UnsafeRowFast>>(
streamArena->pool());
}

void UnsafeRowVectorSerde::deserialize(
Expand Down

0 comments on commit 11a55b6

Please sign in to comment.