Copilot commented on code in PR #50629:
URL: https://github.com/apache/arrow/pull/50629#discussion_r4334980137
##########
cpp/src/parquet/column_reader.h:
##########
@@ -351,105 +383,57 @@ class PARQUET_EXPORT RecordReader {
virtual const void* ReadDictionary(int32_t* dictionary_length) = 0;
/// \brief Decoded definition levels
- int16_t* def_levels() const {
- return reinterpret_cast<int16_t*>(def_levels_->mutable_data());
- }
+ ///
+ /// This always return a valid pointer, except:
+ /// - when the max definition level is zero (non-repeated required values).
+ /// - when `allow_levels_optimization` is true and the column is a flat
optional type.
+ virtual int16_t* def_levels() const = 0;
/// \brief Decoded repetition levels
- int16_t* rep_levels() const {
- return reinterpret_cast<int16_t*>(rep_levels_->mutable_data());
- }
+ ///
+ /// This always return a valid pointer, except when the max repetition level
is
+ /// strictly greater than zero (some repeated fields).
+ virtual int16_t* rep_levels() const = 0;
Review Comment:
The `rep_levels()` contract is documented backwards: the implementation
allocates and exposes repetition levels when `max_repetition_level() > 0`, and
returns `nullptr` for non-repeated fields. Please correct this description so
callers do not assume the pointer is unavailable for repeated columns.
--
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]