MCPcopy Create free account
hub / github.com/apache/arrow / AppendRowGroups

Method AppendRowGroups

cpp/src/parquet/metadata.cc:929–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

927 }
928
929 void AppendRowGroups(FileMetaDataImpl* other) {
930 std::ostringstream diff_output;
931 if (!schema()->Equals(*other->schema(), &diff_output)) {
932 auto msg = "AppendRowGroups requires equal schemas.\n" + diff_output.str();
933 throw ParquetException(msg);
934 }
935
936 // ARROW-13654: `other` may point to self, be careful not to enter an infinite loop
937 const int n = other->num_row_groups();
938 // ARROW-16613: do not use reserve() as that may suppress overallocation
939 // and incur O(n²) behavior on repeated calls to AppendRowGroups().
940 // (see https://en.cppreference.com/w/cpp/container/vector/reserve
941 // about inappropriate uses of reserve()).
942 const auto start = metadata_->row_groups.size();
943 metadata_->row_groups.resize(start + n);
944 for (int i = 0; i < n; i++) {
945 metadata_->row_groups[start + i] = other->row_group(i);
946 metadata_->num_rows += metadata_->row_groups[start + i].num_rows;
947 }
948 }
949
950 std::shared_ptr<FileMetaData> Subset(const std::vector<int>& row_groups) {
951 for (int i : row_groups) {

Callers

nothing calls this directly

Calls 8

ParquetExceptionFunction · 0.85
strMethod · 0.80
resizeMethod · 0.80
schemaFunction · 0.50
EqualsMethod · 0.45
schemaMethod · 0.45
num_row_groupsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected