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

Method Subset

cpp/src/parquet/metadata.cc:955–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

953 }
954
955 std::shared_ptr<FileMetaData> Subset(const std::vector<int>& row_groups) {
956 for (int i : row_groups) {
957 if (i < num_row_groups()) continue;
958
959 throw ParquetException(
960 "The file only has ", num_row_groups(),
961 " row groups, but requested a subset including row group: ", i);
962 }
963
964 std::shared_ptr<FileMetaData> out(new FileMetaData());
965 out->impl_ = std::make_unique<FileMetaDataImpl>();
966 out->impl_->metadata_ = std::make_unique<format::FileMetaData>();
967
968 auto metadata = out->impl_->metadata_.get();
969 metadata->version = metadata_->version;
970 metadata->schema = metadata_->schema;
971
972 metadata->row_groups.resize(row_groups.size());
973
974 int i = 0;
975 for (int selected_index : row_groups) {
976 metadata->num_rows += row_group(selected_index).num_rows;
977 metadata->row_groups[i++] = row_group(selected_index);
978 }
979
980 metadata->key_value_metadata = metadata_->key_value_metadata;
981 metadata->created_by = metadata_->created_by;
982 metadata->column_orders = metadata_->column_orders;
983 metadata->encryption_algorithm = metadata_->encryption_algorithm;
984 metadata->footer_signing_key_metadata = metadata_->footer_signing_key_metadata;
985 metadata->__isset = metadata_->__isset;
986
987 out->impl_->schema_ = schema_;
988 out->impl_->writer_version_ = writer_version_;
989 out->impl_->key_value_metadata_ = key_value_metadata_;
990 out->impl_->file_decryptor_ = file_decryptor_;
991
992 return out;
993 }
994
995 std::string SerializeUnencrypted(bool scrub, bool debug) const {
996 auto md = *metadata_;

Callers

nothing calls this directly

Calls 4

ParquetExceptionFunction · 0.85
resizeMethod · 0.80
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected