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

Function TransferBinary

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

Source from the content-addressed store, hash-verified

588}
589
590Status 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

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