You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/12/31 16:50:41 UTC

[arrow] branch master updated: PARQUET-1484: [C++] Improve memory usage of FileMetaDataBuilder

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d792b1  PARQUET-1484: [C++] Improve memory usage of FileMetaDataBuilder
8d792b1 is described below

commit 8d792b1c196dcb5f745cb48313558a9a35baccc2
Author: Deepak Majeti <de...@hpe.com>
AuthorDate: Mon Dec 31 10:50:30 2018 -0600

    PARQUET-1484: [C++] Improve memory usage of FileMetaDataBuilder
    
    Author: Deepak Majeti <de...@hpe.com>
    
    Closes #3277 from majetideepak/PARQUET-1484 and squashes the following commits:
    
    212e5230 <Deepak Majeti> PARQUET-1484:  Improve memory usage of FileMetaDataBuilder
---
 cpp/src/parquet/metadata.cc | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/cpp/src/parquet/metadata.cc b/cpp/src/parquet/metadata.cc
index 6ac53c5..f05918d 100644
--- a/cpp/src/parquet/metadata.cc
+++ b/cpp/src/parquet/metadata.cc
@@ -851,23 +851,19 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {
   }
 
   RowGroupMetaDataBuilder* AppendRowGroup() {
-    row_groups_.emplace_back(new format::RowGroup);
+    row_groups_.emplace_back();
     current_row_group_builder_ =
-        RowGroupMetaDataBuilder::Make(properties_, schema_, row_groups_.back().get());
+        RowGroupMetaDataBuilder::Make(properties_, schema_, &row_groups_.back());
     return current_row_group_builder_.get();
   }
 
   std::unique_ptr<FileMetaData> Finish() {
     int64_t total_rows = 0;
-    std::vector<format::RowGroup> row_groups;
-    for (auto row_group = row_groups_.begin(); row_group != row_groups_.end();
-         row_group++) {
-      auto rowgroup = *((*row_group).get());
-      row_groups.push_back(rowgroup);
-      total_rows += rowgroup.num_rows;
+    for (auto row_group : row_groups_) {
+      total_rows += row_group.num_rows;
     }
     metadata_->__set_num_rows(total_rows);
-    metadata_->__set_row_groups(row_groups);
+    metadata_->__set_row_groups(row_groups_);
 
     if (key_value_metadata_) {
       metadata_->key_value_metadata.clear();
@@ -922,7 +918,7 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {
 
  private:
   const std::shared_ptr<WriterProperties> properties_;
-  std::vector<std::unique_ptr<format::RowGroup>> row_groups_;
+  std::vector<format::RowGroup> row_groups_;
 
   std::unique_ptr<RowGroupMetaDataBuilder> current_row_group_builder_;
   const SchemaDescriptor* schema_;