Skip to content

Commit

Permalink
Parquet metadata Printing sort-columns if having
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleFU committed Aug 7, 2024
1 parent b852b72 commit e116c3c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cpp/src/parquet/printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ void ParquetFilePrinter::DebugPrint(std::ostream& stream, std::list<int> selecte
stream << "--- Total Bytes: " << group_metadata->total_byte_size() << " ---\n";
stream << "--- Total Compressed Bytes: " << group_metadata->total_compressed_size()
<< " ---\n";
auto sorting_columns = group_metadata->sorting_columns();
if (!sorting_columns.empty()) {
stream << "--- Sort Columns:\n";
for (auto column : sorting_columns) {
stream << "column_idx: " << column.column_idx
<< ", descending: " << column.descending
<< ", nulls_first: " << column.nulls_first << "\n";
}
}
stream << "--- Rows: " << group_metadata->num_rows() << " ---\n";

// Print column metadata
Expand Down Expand Up @@ -267,6 +276,20 @@ void ParquetFilePrinter::JSONPrint(std::ostream& stream, std::list<int> selected
stream << " \"TotalBytes\": \"" << group_metadata->total_byte_size() << "\", ";
stream << " \"TotalCompressedBytes\": \"" << group_metadata->total_compressed_size()
<< "\", ";
auto row_group_sorting_columns = group_metadata->sorting_columns();
if (!row_group_sorting_columns.empty()) {
stream << " \"SortColumns\": [";
for (size_t i = 0; i < row_group_sorting_columns.size(); i++) {
stream << "\"{\"column_idx\":" << row_group_sorting_columns[i].column_idx
<< ", \"descending\":" << row_group_sorting_columns[i].descending
<< ", \"nulls_first\": " << row_group_sorting_columns[i].nulls_first
<< "}";
if (i + 1 != row_group_sorting_columns.size()) {
stream << ", ";
}
}
stream << "], ";
}
stream << " \"Rows\": \"" << group_metadata->num_rows() << "\",\n";

// Print column metadata
Expand Down

0 comments on commit e116c3c

Please sign in to comment.