Skip to content

Commit

Permalink
Augment nimble_dump info subcommand by listing all metadata sections …
Browse files Browse the repository at this point in the history
…by size

Summary: This change augments `nimble_dump`'s `info` subcommand. With this change, we will list all metadata sections in the Nimble file, along with their respective sizes.

Differential Revision: D67958989
  • Loading branch information
Chongfeng Hu authored and facebook-github-bot committed Jan 9, 2025
1 parent fc926ea commit d4782a5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions dwio/nimble/tools/NimbleDumpLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
#include <algorithm>
#include <functional>
#include <locale>
#include <numeric>
#include <ostream>
Expand Down Expand Up @@ -265,8 +266,35 @@ void NimbleDumpLib::emitInfo() {
<< nimble::toString(tablet->checksumType()) << "]" << std::endl;
ostream_ << "Footer Compression: " << tablet->footerCompressionType()
<< std::endl;
ostream_ << "Postscript Size: " << commaSeparated(kPostscriptSize)
<< std::endl;
ostream_ << "Footer Size: " << commaSeparated(tablet->footerSize())
<< std::endl;
ostream_ << "Stripes Metadata Size: "
<< commaSeparated(
tablet->stripesMetadata() ? tablet->stripesMetadata()->size()
: 0)
<< std::endl;
ostream_ << "Stripe Groups Metadata Size: "
<< commaSeparated(std::transform_reduce(
tablet->stripeGroupsMetadata().begin(),
tablet->stripeGroupsMetadata().end(),
0,
std::plus{},
[](const MetadataSection& metadataSection) {
return metadataSection.size();
}))
<< std::endl;
ostream_ << "Optional Sections Size: "
<< commaSeparated(std::transform_reduce(
tablet->optionalSections().begin(),
tablet->optionalSections().end(),
0,
std::plus{},
[](const std::pair<std::string, MetadataSection>& entry) {
return entry.second.size();
}))
<< std::endl;
ostream_ << "Stripe Count: " << commaSeparated(tablet->stripeCount())
<< std::endl;
ostream_ << "Row Count: " << commaSeparated(tablet->tabletRowCount())
Expand Down

0 comments on commit d4782a5

Please sign in to comment.