You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "raulcd (via GitHub)" <gi...@apache.org> on 2025/02/07 09:07:04 UTC

Re: [PR] GH-45366: [C++][Parquet] Allowing is_compressed not set if DataPageV2 enabled [arrow]

raulcd commented on code in PR #45367:
URL: https://github.com/apache/arrow/pull/45367#discussion_r1946198988


##########
cpp/src/parquet/column_writer.cc:
##########
@@ -1033,9 +1033,13 @@ void ColumnWriterImpl::BuildDataPageV2(int64_t definition_levels_rle_size,
   // Compress the values if needed. Repetition and definition levels are uncompressed in
   // V2.
   std::shared_ptr<Buffer> compressed_values;
-  if (pager_->has_compressor()) {
+  bool page_is_compressed = false;
+  if (pager_->has_compressor() && values->size() > 0) {
     pager_->Compress(*values, compressor_temp_buffer_.get());
-    compressed_values = compressor_temp_buffer_;
+    if (compressor_temp_buffer_->size() < values->size()) {
+      compressed_values = compressor_temp_buffer_;
+      page_is_compressed = true;
+    }

Review Comment:
   aren't we missing to set `compressed_values` on the case  of `values->size` being smaller than the compressed size?
   Python tests are currently segfaulting and this is the only thing I can think about without testing and debugging myself.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org