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

Function TransferInt

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

Source from the content-addressed store, hash-verified

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