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

Function TransferBinary

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

Source from the content-addressed store, hash-verified

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

Callers 2

TransferHalfFloatFunction · 0.85
TransferColumnDataFunction · 0.85

Calls 11

TransferDictionaryFunction · 0.85
CastFunction · 0.85
read_dictionaryMethod · 0.80
nullableMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
dictionaryFunction · 0.50
OKFunction · 0.50
typeMethod · 0.45
GetBuilderChunksMethod · 0.45
EqualsMethod · 0.45

Tested by

no test coverage detected