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

[GitHub] [arrow] mapleFU commented on a diff in pull request #37641: GH-37293: [C++][Parquet] Encoding: Add Benchmark for DELTA_BYTE_ARRAY

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


##########
cpp/src/parquet/encoding.cc:
##########
@@ -3370,20 +3375,23 @@ class DeltaByteArrayDecoderImpl : public DecoderImpl, virtual public TypedDecode
         throw ParquetException("excess expansion in DELTA_BYTE_ARRAY");
       }
     }
-    PARQUET_THROW_NOT_OK(buffered_data_->Resize(data_size));
+    PARQUET_THROW_NOT_OK(buffered_data_->Resize(data_size, false));
 
     string_view prefix{last_value_};
     uint8_t* data_ptr = buffered_data_->mutable_data();
     for (int i = 0; i < max_values; ++i) {
       if (ARROW_PREDICT_FALSE(static_cast<size_t>(prefix_len_ptr[i]) > prefix.length())) {
         throw ParquetException("prefix length too large in DELTA_BYTE_ARRAY");
       }
-      memcpy(data_ptr, prefix.data(), prefix_len_ptr[i]);
-      // buffer[i] currently points to the string suffix
-      memcpy(data_ptr + prefix_len_ptr[i], buffer[i].ptr, buffer[i].len);
-      buffer[i].ptr = data_ptr;
-      buffer[i].len += prefix_len_ptr[i];
-      data_ptr += buffer[i].len;
+      // If the prefix length is zero, the prefix can be ignored.

Review Comment:
   This is an (maybe-unused) optimization. When prefix == 0, it avoid round of memcpy.



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