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

Method WriteStringSlot

be/src/exec/system-table-scanner.cc:72–82  ·  view source on GitHub ↗

Write a string value to a STRING slot, allocating memory from 'pool'. Returns an error if memory cannot be allocated without exceeding a memory limit.

Source from the content-addressed store, hash-verified

70/// Write a string value to a STRING slot, allocating memory from 'pool'. Returns
71/// an error if memory cannot be allocated without exceeding a memory limit.
72Status SystemTableScanner::WriteStringSlot(
73 const char* data, int len, MemPool* pool, void* slot) {
74 char* buffer = reinterpret_cast<char*>(pool->TryAllocateUnaligned(len));
75 if (UNLIKELY(buffer == nullptr)) {
76 string details = Substitute(ERROR_MEM_LIMIT_EXCEEDED, "WriteStringSlot", len);
77 return pool->mem_tracker()->MemLimitExceeded(state_, details, len);
78 }
79 memcpy(buffer, data, len);
80 reinterpret_cast<StringValue*>(slot)->Assign(buffer, len);
81 return Status::OK();
82}
83
84Status SystemTableScanner::WriteStringSlot(const string& str, MemPool* pool, void* slot) {
85 return WriteStringSlot(str.data(), str.size(), pool, slot);

Callers

nothing calls this directly

Calls 8

SubstituteFunction · 0.85
OKFunction · 0.85
TryAllocateUnalignedMethod · 0.80
MemLimitExceededMethod · 0.45
mem_trackerMethod · 0.45
AssignMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected