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

Method Load

be/src/exec/blob-reader.h:92–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91template <typename OutputType, typename Deserializer>
92Status BlobReader<OutputType, Deserializer>::Load(io::RequestContext* request_context,
93 MemTracker* mem_tracker, ObjectPool* obj_pool, const std::string& path,
94 int64_t content_offset, int64_t content_length, OutputType* output) {
95 DCHECK(request_context != nullptr);
96 DCHECK(mem_tracker != nullptr);
97 DCHECK(obj_pool != nullptr);
98 DCHECK(output != nullptr);
99
100 // Allocate buffer for reading the blob
101 ScopedBuffer buffer(mem_tracker);
102 if (!buffer.TryAllocate(content_length)) {
103 return Status(strings::Substitute(
104 "Could not allocate buffer of $0 bytes for blob file '$1'.",
105 content_length, path));
106 }
107
108 // Get HDFS connection
109 io::ScanRange::FileInfo file_info;
110 file_info.mtime = 1;
111 RETURN_IF_ERROR(HdfsFsCache::instance()->GetConnection(
112 path, &file_info.fs, &fs_cache_));
113 file_info.filename = path.c_str();
114
115 // Create scan range for the blob content
116 io::ScanRange* scan_range = io::ScanRange::AllocateScanRange(obj_pool, file_info,
117 content_length, content_offset, {}, nullptr, -1, false,
118 io::BufferOpts::ReadInto(buffer.buffer(), buffer.Size(),
119 io::BufferOpts::USE_DATA_CACHE));
120
121 // Read the blob data
122 std::unique_ptr<io::BufferDescriptor> io_buffer;
123 bool needs_buffers;
124 RETURN_IF_ERROR(request_context->StartScanRange(scan_range, &needs_buffers));
125 DCHECK(!needs_buffers) << "Already provided a buffer";
126 RETURN_IF_ERROR(scan_range->GetNext(&io_buffer));
127 scan_range->ReturnBuffer(std::move(io_buffer));
128
129 return Deserializer::Deserialize(buffer.buffer(), content_length, output);
130}
131
132/// Size of the blob header (length + magic) for deletion vector blobs
133static constexpr int DELETION_VECTOR_BLOB_HEADER_SIZE = 8;

Callers 15

DebugStringMethod · 0.45
GetNumActiveMethod · 0.45
doneMethod · 0.45
OpenMethod · 0.45
CloseMethod · 0.45
last_batch_returnedMethod · 0.45
GetNextScanRangeMethod · 0.45
CalculateDataFilesMethod · 0.45

Calls 10

SubstituteFunction · 0.85
moveFunction · 0.85
StartScanRangeMethod · 0.80
ReturnBufferMethod · 0.80
StatusClass · 0.70
TryAllocateMethod · 0.45
GetConnectionMethod · 0.45
bufferMethod · 0.45
SizeMethod · 0.45
GetNextMethod · 0.45

Tested by

no test coverage detected