pitrou commented on a change in pull request #8203:
URL: https://github.com/apache/arrow/pull/8203#discussion_r489593595



##########
File path: cpp/src/arrow/testing/random.cc
##########
@@ -250,12 +267,20 @@ std::shared_ptr<Array> 
RandomArrayGenerator::StringWithRepeats(int64_t size,
 }
 
 std::shared_ptr<Array> RandomArrayGenerator::Offsets(int64_t size, int32_t 
first_offset,
-                                                     int32_t last_offset) {
+                                                     int32_t last_offset,
+                                                     double null_probability) {
   using GenOpt = GenerateOptions<int32_t, 
std::uniform_int_distribution<int32_t>>;
-  GenOpt options(seed(), first_offset, last_offset, /*null_probability=*/0);
+  GenOpt options(seed(), first_offset, last_offset, null_probability);
 
   BufferVector buffers{2};
 
+  int64_t null_count = 0;
+  buffers[0] = *AllocateEmptyBitmap(size);
+  options.GenerateBitmap(buffers[0]->mutable_data(), size, &null_count);
+  // Make sure the first and last entry are non-null

Review comment:
       I'd rather keep this after all. It doesn't hurt and at least half of it 
is necessary.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to