emkornfield commented on code in PR #14142:
URL: https://github.com/apache/arrow/pull/14142#discussion_r984250415


##########
cpp/src/parquet/column_reader.cc:
##########
@@ -1329,6 +1332,183 @@ class TypedRecordReader : public 
ColumnReaderImplBase<DType>,
     return records_read;
   }
 
+  // Throw away levels from start_levels_position to levels_position_.
+  // Will update levels_position_ and levels_written_ accordingly and move
+  // the levels to left to fill in the gap. It will not shrink the size
+  // of the buffer or overwrite the positions after levels_written_.
+  // This is inefficient, though necessary to consume levels that we have
+  // already read into the buffer and we want to Skip.
+  void ThrowAwayLevels(int64_t start_levels_position) {
+       ARROW_DCHECK_LE(levels_position_, levels_written_);
+       ARROW_DCHECK_LE(start_levels_position, levels_position_);
+       int64_t gap = levels_position_ - start_levels_position;
+
+       for (int64_t i = levels_position_; i < levels_written_; ++i) {
+         *(def_levels() + i - gap) = *(def_levels() + i);

Review Comment:
   nit: would it make sense to use std::copy or std::copy_backward 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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to