mapleFU commented on code in PR #41346:
URL: https://github.com/apache/arrow/pull/41346#discussion_r1597546712


##########
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:
   IMO, throw is the duty of `ReadLevels`, a internal `ReadLevel` 
implementation cannot read more data than input batch-size



-- 
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]

Reply via email to