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

Method DebugPrint

cpp/src/parquet/printer.cc:88–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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