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