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

Method FixedSizeBinary

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

Source from the content-addressed store, hash-verified

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

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