pitrou commented on code in PR #14341:
URL: https://github.com/apache/arrow/pull/14341#discussion_r1295885665


##########
cpp/src/parquet/test_util.h:
##########
@@ -783,8 +789,33 @@ inline void GenerateData<ByteArray>(int num_values, 
ByteArray* out,
   random_byte_array(num_values, 0, heap->data(), out, 2, max_byte_array_len);
 }
 
+template <typename T>
+inline void GeneratePrefixedData(int num_values, T* out, std::vector<uint8_t>* 
heap,
+                                 double prefixed_probability);
+
+template <>
+inline void GeneratePrefixedData(int num_values, ByteArray* out,
+                                 std::vector<uint8_t>* heap,
+                                 double prefixed_probability) {
+  // seed the prng so failure is deterministic
+  int max_byte_array_len = 12;
+  heap->resize(num_values * max_byte_array_len);

Review Comment:
   The comment would deserve being put just above the line it applies to :-)
   ```suggestion
     int max_byte_array_len = 12;
     heap->resize(num_values * max_byte_array_len);
     // seed the prng so failure is deterministic
   ```



##########
cpp/src/parquet/test_util.h:
##########
@@ -783,8 +789,33 @@ inline void GenerateData<ByteArray>(int num_values, 
ByteArray* out,
   random_byte_array(num_values, 0, heap->data(), out, 2, max_byte_array_len);
 }
 
+template <typename T>
+inline void GeneratePrefixedData(int num_values, T* out, std::vector<uint8_t>* 
heap,
+                                 double prefixed_probability);
+
+template <>
+inline void GeneratePrefixedData(int num_values, ByteArray* out,
+                                 std::vector<uint8_t>* heap,
+                                 double prefixed_probability) {
+  // seed the prng so failure is deterministic
+  int max_byte_array_len = 12;
+  heap->resize(num_values * max_byte_array_len);
+  prefixed_random_byte_array(num_values, /*seed=*/0, heap->data(), out, 
/*min_size=*/2,
+                             /*max_size=*/max_byte_array_len, 
prefixed_probability);
+}
+
 static constexpr int kGenerateDataFLBALength = 8;
 
+template <>
+inline void GeneratePrefixedData<FLBA>(int num_values, FLBA* out,
+                                       std::vector<uint8_t>* heap,
+                                       double prefixed_probability) {
+  // seed the prng so failure is deterministic

Review Comment:
   Same here.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to