MCPcopy Create free account
hub / github.com/apache/arrow / TransferInt

Function TransferInt

cpp/src/parquet/arrow/reader_internal.cc:424–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

422
423template <typename ArrowType, typename ParquetType>
424Status TransferInt(RecordReader* reader,
425 std::unique_ptr<::parquet::ColumnChunkMetaData> metadata,
426 const ReaderContext* ctx, const std::shared_ptr<Field>& field,
427 Datum* out) {
428 using ArrowCType = typename ArrowType::c_type;
429 using ParquetCType = typename ParquetType::c_type;
430 int64_t length = reader->values_written();
431 ARROW_ASSIGN_OR_RAISE(auto data,
432 ::arrow::AllocateBuffer(length * sizeof(ArrowCType), ctx->pool));
433
434 auto values = reinterpret_cast<const ParquetCType*>(reader->values());
435 auto out_ptr = reinterpret_cast<ArrowCType*>(data->mutable_data());
436 std::copy(values, values + length, out_ptr);
437 int64_t null_count = 0;
438 std::vector<std::shared_ptr<Buffer>> buffers = {nullptr, std::move(data)};
439 if (field->nullable()) {
440 null_count = reader->null_count();
441 buffers[0] = reader->ReleaseIsValid();
442 }
443 auto array_data =
444 ::arrow::ArrayData::Make(field->type(), length, std::move(buffers), null_count);
445 AttachStatistics<ArrowType, ParquetType>(array_data.get(), std::move(metadata), ctx);
446 *out = std::make_shared<ArrayType<ArrowType>>(std::move(array_data));
447 return Status::OK();
448}
449
450template <typename ArrowType, typename ParquetType>
451std::shared_ptr<Array> TransferZeroCopy(

Callers

nothing calls this directly

Calls 9

nullableMethod · 0.80
ReleaseIsValidMethod · 0.80
MakeFunction · 0.50
OKFunction · 0.50
valuesMethod · 0.45
mutable_dataMethod · 0.45
null_countMethod · 0.45
typeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected