MCPcopy Create free account
hub / github.com/apache/impala / FromProtobuf

Method FromProtobuf

be/src/runtime/row-batch.cc:176–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176Status RowBatch::FromProtobuf(const RowDescriptor* row_desc,
177 const RowBatchHeaderPB& header, const kudu::Slice& input_tuple_offsets,
178 const kudu::Slice& input_tuple_data, MemTracker* mem_tracker,
179 BufferPool::ClientHandle* client, unique_ptr<RowBatch>* row_batch_ptr) {
180 unique_ptr<RowBatch> row_batch(new RowBatch(row_desc, header, mem_tracker));
181
182 DCHECK(client != nullptr);
183 row_batch->tuple_ptrs_info_.reset(new BufferInfo());
184 row_batch->tuple_ptrs_info_->client = client;
185 BufferPool::BufferHandle* tuple_ptrs_buffer = &(row_batch->tuple_ptrs_info_->buffer);
186 RETURN_IF_ERROR(
187 row_batch->AllocateBuffer(client, row_batch->tuple_ptrs_size_, tuple_ptrs_buffer));
188 row_batch->tuple_ptrs_ = reinterpret_cast<Tuple**>(tuple_ptrs_buffer->data());
189
190 const int64_t uncompressed_size = header.uncompressed_size();
191 BufferPool::BufferHandle tuple_data_buffer;
192 RETURN_IF_ERROR(
193 row_batch->AllocateBuffer(client, uncompressed_size, &tuple_data_buffer));
194 uint8_t* tuple_data = tuple_data_buffer.data();
195 row_batch->AddBuffer(client, move(tuple_data_buffer), FlushMode::NO_FLUSH_RESOURCES);
196
197 row_batch->num_rows_ = header.num_rows();
198 row_batch->capacity_ = header.num_rows();
199 const CompressionTypePB& compression_type = header.compression_type();
200 DCHECK(compression_type == CompressionTypePB::NONE ||
201 compression_type == CompressionTypePB::LZ4)
202 << "Unexpected compression type: " << compression_type;
203 row_batch->Deserialize(input_tuple_offsets, input_tuple_data, uncompressed_size,
204 compression_type == CompressionTypePB::LZ4, tuple_data);
205 *row_batch_ptr = std::move(row_batch);
206 return Status::OK();
207}
208
209RowBatch::~RowBatch() {
210 tuple_data_pool_.FreeAll();

Callers

nothing calls this directly

Calls 8

moveFunction · 0.85
OKFunction · 0.85
AddBufferMethod · 0.80
resetMethod · 0.65
AllocateBufferMethod · 0.45
dataMethod · 0.45
num_rowsMethod · 0.45
DeserializeMethod · 0.45

Tested by

no test coverage detected