| 588 | } |
| 589 | |
| 590 | Status TransferBinary(RecordReader* reader, MemoryPool* pool, |
| 591 | const std::shared_ptr<Field>& logical_type_field, |
| 592 | std::shared_ptr<ChunkedArray>* out) { |
| 593 | if (reader->read_dictionary()) { |
| 594 | return TransferDictionary( |
| 595 | reader, pool, ::arrow::dictionary(::arrow::int32(), logical_type_field->type()), |
| 596 | logical_type_field->nullable(), out); |
| 597 | } |
| 598 | ::arrow::compute::ExecContext ctx(pool); |
| 599 | ::arrow::compute::CastOptions cast_options; |
| 600 | cast_options.allow_invalid_utf8 = true; // avoid spending time validating UTF8 data |
| 601 | |
| 602 | auto binary_reader = dynamic_cast<BinaryRecordReader*>(reader); |
| 603 | DCHECK(binary_reader); |
| 604 | auto chunks = binary_reader->GetBuilderChunks(); |
| 605 | for (auto& chunk : chunks) { |
| 606 | if (!chunk->type()->Equals(*logical_type_field->type())) { |
| 607 | // XXX: if a LargeBinary chunk is larger than 2GB, the MSBs of offsets |
| 608 | // will be lost because they are first created as int32 and then cast to int64. |
| 609 | ARROW_ASSIGN_OR_RAISE( |
| 610 | chunk, |
| 611 | ::arrow::compute::Cast(*chunk, logical_type_field->type(), cast_options, &ctx)); |
| 612 | } |
| 613 | } |
| 614 | if (!logical_type_field->nullable()) { |
| 615 | ReconstructChunksWithoutNulls(&chunks); |
| 616 | } |
| 617 | *out = std::make_shared<ChunkedArray>(std::move(chunks), logical_type_field->type()); |
| 618 | return Status::OK(); |
| 619 | } |
| 620 | |
| 621 | // ---------------------------------------------------------------------- |
| 622 | // INT32 / INT64 / BYTE_ARRAY / FIXED_LEN_BYTE_ARRAY -> Decimal128 || Decimal256 |
no test coverage detected