fatemehp commented on code in PR #14142:
URL: https://github.com/apache/arrow/pull/14142#discussion_r1004908371
##########
cpp/src/parquet/column_reader.cc:
##########
@@ -1347,16 +1346,24 @@ class TypedRecordReader : public
TypedColumnReaderImpl<DType>,
int64_t gap = levels_position_ - start_levels_position;
if (gap == 0) return;
- std::copy(def_levels() + levels_position_, def_levels() + levels_written_,
- def_levels() + levels_position_ - gap);
+ int64_t levels_remaining = levels_written_ - gap;
+
+ int16_t* def_data = def_levels();
+ std::copy(def_data + levels_position_, def_data + levels_written_,
Review Comment:
Yes, they can. However levels_position - gap is smaller than levels_position
(we return for gap = 0 above). So we can safely use std::copy:
"Copies all elements in the range [first, last) starting from first and
proceeding to last - 1. The behavior is undefined if d_first is within the
range [first, last). In this case,
[std::copy_backward](https://en.cppreference.com/w/cpp/algorithm/copy_backward)
may be used instead."
--
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]