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

Method DebugPrint

cpp/src/parquet/printer.cc:86–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84// ParquetFilePrinter::DebugPrint
85
86void ParquetFilePrinter::DebugPrint(std::ostream& stream, std::list<int> selected_columns,
87 bool print_values, bool format_dump,
88 bool print_key_value_metadata, const char* filename) {
89 const FileMetaData* file_metadata = fileReader->metadata().get();
90
91 stream << "File Name: " << filename << "\n";
92 stream << "Version: " << ParquetVersionToString(file_metadata->version()) << "\n";
93 stream << "Created By: " << file_metadata->created_by() << "\n";
94 stream << "Total rows: " << file_metadata->num_rows() << "\n";
95
96 if (print_key_value_metadata && file_metadata->key_value_metadata()) {
97 auto key_value_metadata = file_metadata->key_value_metadata();
98 PrintKeyValueMetadata(stream, *key_value_metadata);
99 }
100
101 stream << "Number of RowGroups: " << file_metadata->num_row_groups() << "\n";
102 stream << "Number of Real Columns: "
103 << file_metadata->schema()->group_node()->field_count() << "\n";
104
105 if (selected_columns.size() == 0) {
106 for (int i = 0; i < file_metadata->num_columns(); i++) {
107 selected_columns.push_back(i);
108 }
109 } else {
110 for (auto i : selected_columns) {
111 if (i < 0 || i >= file_metadata->num_columns()) {
112 throw ParquetException("Selected column is out of range");
113 }
114 }
115 }
116
117 stream << "Number of Columns: " << file_metadata->num_columns() << "\n";
118 stream << "Number of Selected Columns: " << selected_columns.size() << "\n";
119 for (auto i : selected_columns) {
120 const ColumnDescriptor* descr = file_metadata->schema()->Column(i);
121 stream << "Column " << i << ": " << descr->path()->ToDotString() << " ("
122 << TypeToString(descr->physical_type(), descr->type_length());
123 const auto& logical_type = descr->logical_type();
124 if (!logical_type->is_none()) {
125 stream << " / " << logical_type->ToString();
126 }
127 if (descr->converted_type() != ConvertedType::NONE) {
128 stream << " / " << ConvertedTypeToString(descr->converted_type());
129 if (descr->converted_type() == ConvertedType::DECIMAL) {
130 stream << "(" << descr->type_precision() << "," << descr->type_scale() << ")";
131 }
132 }
133 stream << ")" << std::endl;
134 }
135
136 for (int r = 0; r < file_metadata->num_row_groups(); ++r) {
137 stream << "--- Row Group: " << r << " ---\n";
138
139 auto group_reader = fileReader->RowGroup(r);
140 std::unique_ptr<RowGroupMetaData> group_metadata = file_metadata->RowGroup(r);
141
142 stream << "--- Total Bytes: " << group_metadata->total_byte_size() << " ---\n";
143 stream << "--- Total Compressed Bytes: " << group_metadata->total_compressed_size()

Callers 3

mainFunction · 0.80
TEST_FFunction · 0.80
TESTFunction · 0.80

Calls 15

ParquetVersionToStringFunction · 0.85
PrintKeyValueMetadataFunction · 0.85
ParquetExceptionFunction · 0.85
TypeToStringFunction · 0.85
ConvertedTypeToStringFunction · 0.85
FormatStatValueFunction · 0.85
AsciiToUpperFunction · 0.85
EncodingToStringFunction · 0.85
PrintPageEncodingStatsFunction · 0.85
push_backMethod · 0.80
ToDotStringMethod · 0.80
physical_typeMethod · 0.80

Tested by 2

TEST_FFunction · 0.64
TESTFunction · 0.64