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


##########
cpp/src/parquet/column_reader.cc:
##########
@@ -1829,21 +1831,34 @@ class TypedRecordReader : public 
TypedColumnReaderImpl<DType>,
 
     int64_t null_count = 0;
     if (leaf_info_.HasNullableValues()) {
-      ValidityBitmapInputOutput validity_io;
-      validity_io.values_read_upper_bound = levels_position_ - 
start_levels_position;
-      validity_io.valid_bits = valid_bits_->mutable_data();
-      validity_io.valid_bits_offset = values_written_;
-
-      DefLevelsToBitmap(def_levels() + start_levels_position,
-                        levels_position_ - start_levels_position, leaf_info_,
-                        &validity_io);
-      values_to_read = validity_io.values_read - validity_io.null_count;
-      null_count = validity_io.null_count;
-      DCHECK_GE(values_to_read, 0);
-      ReadValuesSpaced(validity_io.values_read, null_count);
+      if (read_dense_for_nullable_) {
+        DCHECK_GE(values_to_read, 0);
+        ReadValuesDense(values_to_read);
+        // Total values, if reading dense, we don't have the nulls in the 
values
+        // vector.
+        values_written_ += values_to_read;
+        // Any values with def_level < max_def_level is considered null.
+        null_count = levels_position_ - start_levels_position - values_to_read;
+      } else {
+        ValidityBitmapInputOutput validity_io;
+        validity_io.values_read_upper_bound = levels_position_ - 
start_levels_position;
+        validity_io.valid_bits = valid_bits_->mutable_data();
+        validity_io.valid_bits_offset = values_written_;
+
+        DefLevelsToBitmap(def_levels() + start_levels_position,
+                          levels_position_ - start_levels_position, leaf_info_,
+                          &validity_io);
+        values_to_read = validity_io.values_read - validity_io.null_count;
+        null_count = validity_io.null_count;
+        ARROW_DCHECK_GE(values_to_read, 0);

Review Comment:
   is ARROW_DCHECK_GE defined (looks like it was just DHECK_EQ beore.



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