datafusion_datasource_parquet/
metrics.rs1use datafusion_physical_plan::metrics::{
19 Count, ExecutionPlanMetricsSet, MetricBuilder, MetricType, PruningMetrics,
20 RatioMergeStrategy, RatioMetrics, Time,
21};
22
23#[derive(Debug, Clone)]
30pub struct ParquetFileMetrics {
31 pub files_ranges_pruned_statistics: PruningMetrics,
46 pub predicate_evaluation_errors: Count,
48 pub row_groups_pruned_bloom_filter: PruningMetrics,
50 pub row_groups_pruned_statistics: PruningMetrics,
52 pub bytes_scanned: Count,
54 pub pushdown_rows_pruned: Count,
56 pub pushdown_rows_matched: Count,
58 pub row_pushdown_eval_time: Time,
60 pub statistics_eval_time: Time,
62 pub bloom_filter_eval_time: Time,
64 pub page_index_rows_pruned: PruningMetrics,
66 pub page_index_eval_time: Time,
68 pub metadata_load_time: Time,
70 pub scan_efficiency_ratio: RatioMetrics,
72 pub predicate_cache_inner_records: Count,
75 pub predicate_cache_records: Count,
79}
80
81impl ParquetFileMetrics {
82 pub fn new(
84 partition: usize,
85 filename: &str,
86 metrics: &ExecutionPlanMetricsSet,
87 ) -> Self {
88 let row_groups_pruned_bloom_filter = MetricBuilder::new(metrics)
92 .with_new_label("filename", filename.to_string())
93 .with_type(MetricType::SUMMARY)
94 .pruning_metrics("row_groups_pruned_bloom_filter", partition);
95
96 let row_groups_pruned_statistics = MetricBuilder::new(metrics)
97 .with_new_label("filename", filename.to_string())
98 .with_type(MetricType::SUMMARY)
99 .pruning_metrics("row_groups_pruned_statistics", partition);
100
101 let page_index_rows_pruned = MetricBuilder::new(metrics)
102 .with_new_label("filename", filename.to_string())
103 .with_type(MetricType::SUMMARY)
104 .pruning_metrics("page_index_rows_pruned", partition);
105
106 let bytes_scanned = MetricBuilder::new(metrics)
107 .with_new_label("filename", filename.to_string())
108 .with_type(MetricType::SUMMARY)
109 .counter("bytes_scanned", partition);
110
111 let metadata_load_time = MetricBuilder::new(metrics)
112 .with_new_label("filename", filename.to_string())
113 .with_type(MetricType::SUMMARY)
114 .subset_time("metadata_load_time", partition);
115
116 let files_ranges_pruned_statistics = MetricBuilder::new(metrics)
117 .with_type(MetricType::SUMMARY)
118 .pruning_metrics("files_ranges_pruned_statistics", partition);
119
120 let scan_efficiency_ratio = MetricBuilder::new(metrics)
121 .with_new_label("filename", filename.to_string())
122 .with_type(MetricType::SUMMARY)
123 .ratio_metrics_with_strategy(
124 "scan_efficiency_ratio",
125 partition,
126 RatioMergeStrategy::AddPartSetTotal,
127 );
128
129 let predicate_evaluation_errors = MetricBuilder::new(metrics)
133 .with_new_label("filename", filename.to_string())
134 .counter("predicate_evaluation_errors", partition);
135
136 let pushdown_rows_pruned = MetricBuilder::new(metrics)
137 .with_new_label("filename", filename.to_string())
138 .counter("pushdown_rows_pruned", partition);
139 let pushdown_rows_matched = MetricBuilder::new(metrics)
140 .with_new_label("filename", filename.to_string())
141 .counter("pushdown_rows_matched", partition);
142
143 let row_pushdown_eval_time = MetricBuilder::new(metrics)
144 .with_new_label("filename", filename.to_string())
145 .subset_time("row_pushdown_eval_time", partition);
146 let statistics_eval_time = MetricBuilder::new(metrics)
147 .with_new_label("filename", filename.to_string())
148 .subset_time("statistics_eval_time", partition);
149 let bloom_filter_eval_time = MetricBuilder::new(metrics)
150 .with_new_label("filename", filename.to_string())
151 .subset_time("bloom_filter_eval_time", partition);
152
153 let page_index_eval_time = MetricBuilder::new(metrics)
154 .with_new_label("filename", filename.to_string())
155 .subset_time("page_index_eval_time", partition);
156
157 let predicate_cache_inner_records = MetricBuilder::new(metrics)
158 .with_new_label("filename", filename.to_string())
159 .counter("predicate_cache_inner_records", partition);
160
161 let predicate_cache_records = MetricBuilder::new(metrics)
162 .with_new_label("filename", filename.to_string())
163 .counter("predicate_cache_records", partition);
164
165 Self {
166 files_ranges_pruned_statistics,
167 predicate_evaluation_errors,
168 row_groups_pruned_bloom_filter,
169 row_groups_pruned_statistics,
170 bytes_scanned,
171 pushdown_rows_pruned,
172 pushdown_rows_matched,
173 row_pushdown_eval_time,
174 page_index_rows_pruned,
175 statistics_eval_time,
176 bloom_filter_eval_time,
177 page_index_eval_time,
178 metadata_load_time,
179 scan_efficiency_ratio,
180 predicate_cache_inner_records,
181 predicate_cache_records,
182 }
183 }
184}