| 423 | |
| 424 | template <typename ArrowType, typename ParquetType> |
| 425 | Status 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 | |
| 451 | template <typename ArrowType, typename ParquetType> |
| 452 | std::shared_ptr<Array> TransferZeroCopy( |
nothing calls this directly
no test coverage detected