static
| 18 | namespace bytedance::bolt::exec { |
| 19 | // static |
| 20 | void ContainerRow2RowSerde::serialize( |
| 21 | char* row, |
| 22 | char*& current, |
| 23 | const char* bufferEnd, |
| 24 | const RowFormatInfo& info) { |
| 25 | simd::memcpy(current, row, info.fixRowSize); |
| 26 | char* currentHead = current; |
| 27 | current += info.fixRowSize; |
| 28 | |
| 29 | for (const auto& [isStr, rowColumn] : info.variableColumns) { |
| 30 | if (RowContainer::isNullAt(row, rowColumn)) { |
| 31 | continue; |
| 32 | } |
| 33 | if (isStr) { |
| 34 | const StringView& sv = |
| 35 | *reinterpret_cast<StringView*>(row + rowColumn.offset()); |
| 36 | if (!sv.isInline()) { |
| 37 | if (reinterpret_cast<const HashStringAllocator::Header*>(sv.data())[-1] |
| 38 | .size() >= sv.size()) { |
| 39 | simd::memcpy(current, sv.data(), sv.size()); |
| 40 | } else { |
| 41 | auto stream = HashStringAllocator::prepareRead( |
| 42 | HashStringAllocator::headerOf(sv.data())); |
| 43 | stream->readBytes(current, sv.size()); |
| 44 | } |
| 45 | // clear data ptr of StringView to increase compress ratio |
| 46 | *(char**)(currentHead + rowColumn.offset() + sizeof(uint64_t)) = |
| 47 | nullptr; |
| 48 | current += sv.size(); |
| 49 | BOLT_CHECK(current <= bufferEnd); |
| 50 | } |
| 51 | } else { |
| 52 | const auto value = |
| 53 | *reinterpret_cast<std::string_view*>(row + rowColumn.offset()); |
| 54 | |
| 55 | auto stream = HashStringAllocator::prepareRead( |
| 56 | HashStringAllocator::headerOf(value.data())); |
| 57 | stream->readBytes(current, value.size()); |
| 58 | current += value.size(); |
| 59 | BOLT_CHECK(current <= bufferEnd); |
| 60 | } |
| 61 | } |
| 62 | for (auto& accumulator : info.serializableAccumulators) { |
| 63 | current = accumulator.serializeAccumulator(currentHead, current); |
| 64 | BOLT_CHECK(current <= bufferEnd); |
| 65 | } |
| 66 | |
| 67 | // make row size aligned with alignment |
| 68 | auto actualSize = current - currentHead; |
| 69 | auto rowSize = bits::roundUp(actualSize, info.alignment); |
| 70 | current += rowSize - actualSize; |
| 71 | } |
| 72 | |
| 73 | // static |
| 74 | int32_t ContainerRow2RowSerde::deserialize( |
nothing calls this directly
no test coverage detected