drin commented on code in PR #13330:
URL: https://github.com/apache/arrow/pull/13330#discussion_r947222902
##########
cpp/src/arrow/util/rle_util.cc:
##########
@@ -0,0 +1,32 @@
+#include "arrow/util/rle_util.h"
+#include <algorithm>
+#include "arrow/builder.h"
+
+namespace arrow {
+namespace rle_util {
+
+int64_t FindPhysicalOffset(const int32_t* accumulated_run_lengths,
+ int64_t physical_length, int64_t logical_offset) {
+ auto it = std::upper_bound(accumulated_run_lengths,
+ accumulated_run_lengths + physical_length,
logical_offset);
+ return std::distance(accumulated_run_lengths, it);
+}
+
+int64_t FindPhysicalIndex(const int32_t* accumulated_run_lengths,
+ int64_t physical_length, int64_t physical_offset,
int64_t logical_offset, int64_t logical_index) {
+ auto it = std::upper_bound(accumulated_run_lengths + physical_offset,
+ accumulated_run_lengths + physical_offset +
physical_length,
+ logical_index + logical_offset);
Review Comment:
I don't understand the difference between logical index and logical offset
based on the provided tests. Or, more specifically, they seem to share the same
domain (values in the `run_lengths` list).
--
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]