felipecrv commented on code in PR #14223:
URL: https://github.com/apache/arrow/pull/14223#discussion_r1091067966


##########
dev/archery/archery/integration/datagen.py:
##########
@@ -193,6 +193,28 @@ def generate_range(self, size, lower, upper, name=None,
         return PrimitiveColumn(name, size, is_valid, values)
 
 
+# Integer field that fulfils the requirements for the run ends field of RLE.
+# The integers are positive and in a strictly increasing sequence
+class RunEndsField(IntegerField):
+    def __init__(self, name, bit_width, *, nullable=False,
+                 metadata=None):
+        super().__init__(name, is_signed=True, bit_width=bit_width,
+                         nullable=nullable, metadata=metadata, min_value=1)
+
+    def generate_range(self, size, lower, upper, name=None,
+                       include_extremes=False):
+        # values = np.random.randint(lower, upper, size=size, dtype=np.int64)
+        rng = np.random.default_rng()
+        values = rng.choice(2 ** (self.bit_width - 1) - 1, size=size, 
replace=False)

Review Comment:
   A way of interpreting run-ends that is useful to me in understanding them:
   
   `run_end = base_index + length` and `length > 0` because an empty run 
(`length == 0`) doesn't have to exist.



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