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

Method FixedSizeBinary

cpp/src/arrow/testing/random.cc:585–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583}
584
585std::shared_ptr<Array> RandomArrayGenerator::FixedSizeBinary(
586 int64_t size, int32_t byte_width, double null_probability, uint8_t min_byte,
587 uint8_t max_byte, int64_t alignment, MemoryPool* memory_pool) {
588 if (null_probability < 0 || null_probability > 1) {
589 ABORT_NOT_OK(Status::Invalid("null_probability must be between 0 and 1"));
590 }
591
592 // Visual Studio does not implement uniform_int_distribution for char types.
593 using GenOpt = GenerateOptions<uint8_t, std::uniform_int_distribution<uint16_t>>;
594 GenOpt options(seed(), min_byte, max_byte, null_probability);
595
596 int64_t null_count = 0;
597 auto null_bitmap = *AllocateEmptyBitmap(size, alignment, memory_pool);
598 auto data_buffer = *AllocateBuffer(size * byte_width, alignment, memory_pool);
599 options.GenerateBitmap(null_bitmap->mutable_data(), size, &null_count);
600 options.GenerateData(data_buffer->mutable_data(), size * byte_width);
601
602 auto type = fixed_size_binary(byte_width);
603 return std::make_shared<FixedSizeBinaryArray>(type, size, std::move(data_buffer),
604 std::move(null_bitmap), null_count);
605}
606
607namespace {
608

Callers 6

GenRandomRecordsFunction · 0.45
TESTFunction · 0.45
CheckRoundtripMethod · 0.45
SampleDataFunction · 0.45

Calls 8

seedFunction · 0.85
AllocateEmptyBitmapFunction · 0.85
fixed_size_binaryFunction · 0.85
GenerateBitmapMethod · 0.80
InvalidFunction · 0.50
AllocateBufferFunction · 0.50
mutable_dataMethod · 0.45
GenerateDataMethod · 0.45

Tested by 3

GenRandomRecordsFunction · 0.36
TESTFunction · 0.36
CheckRoundtripMethod · 0.36