mapleFU commented on code in PR #41346: URL: https://github.com/apache/arrow/pull/41346#discussion_r1600017778
########## cpp/src/parquet/column_reader.cc: ########## @@ -1115,20 +1129,27 @@ int64_t TypedColumnReaderImpl<DType>::ReadBatch(int64_t batch_size, int16_t* def // TODO(wesm): keep reading data pages until batch_size is reached, or the // row group is finished int64_t num_def_levels = 0; - int64_t values_to_read = 0; - ReadLevels(batch_size, def_levels, rep_levels, &num_def_levels, &values_to_read); - - *values_read = this->ReadValues(values_to_read, values); + // Number of non-null values to read within `num_def_levels`. + int64_t non_null_values_to_read = 0; + ReadLevels(batch_size, def_levels, rep_levels, &num_def_levels, + &non_null_values_to_read); + // Should not return more values than available in the current data page. + ARROW_DCHECK_LE(num_def_levels, this->available_values_current_page()); Review Comment: Never, since: ```c++ // ReadLevels will throw exception when any num-levels read is not equal to the number // of the levels can be read. ``` Here we just do dcheck to check that `ReadLevels` has well done this -- 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]
