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

Method WriteStringOrBinarySlot

be/src/exec/paimon/paimon-jni-row-reader.cc:286–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284/// memory later.
285template <bool IS_BINARY>
286Status PaimonJniRowReader::WriteStringOrBinarySlot(
287 const arrow::Array* array, const int row_idx, void* slot, MemPool* tuple_data_pool) {
288 std::string_view v;
289 uint32_t jbuffer_size = 0;
290 if constexpr (IS_BINARY) {
291 const arrow::BinaryArray* binary_array =
292 static_cast<const arrow::BinaryArray*>(array);
293 v = binary_array->Value(row_idx);
294 } else {
295 const arrow::StringArray* string_array =
296 static_cast<const arrow::StringArray*>(array);
297 v = string_array->Value(row_idx);
298 }
299
300 jbuffer_size = v.size();
301 // Allocate memory and copy the bytes from the JVM to the RowBatch.
302 char* buffer =
303 reinterpret_cast<char*>(tuple_data_pool->TryAllocateUnaligned(jbuffer_size));
304 if (UNLIKELY(buffer == nullptr)) {
305 string details = strings::Substitute("Failed to allocate $0 bytes for $1.",
306 jbuffer_size, IS_BINARY ? "binary" : "string");
307 return tuple_data_pool->mem_tracker()->MemLimitExceeded(
308 nullptr, details, jbuffer_size);
309 }
310
311 memcpy(buffer, v.data(), jbuffer_size);
312 reinterpret_cast<StringValue*>(slot)->Assign(buffer, jbuffer_size);
313 return Status::OK();
314}
315} // namespace impala

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected