|
22 | 22 |
|
23 | 23 | namespace doris::format::parquet { |
24 | 24 |
|
| 25 | +const ParquetProfile& ParquetProfileCache::get() { |
| 26 | + std::call_once(_initialized, [this] { _counters.init(_profile); }); |
| 27 | + return _counters; |
| 28 | +} |
| 29 | + |
25 | 30 | namespace { |
26 | 31 |
|
27 | 32 | std::shared_ptr<RuntimeProfile::Counter> add_persistent_counter(RuntimeProfile* profile, |
@@ -107,34 +112,36 @@ void ParquetProfile::init(RuntimeProfile* profile) { |
107 | 112 | ADD_CHILD_TIMER_WITH_LEVEL(profile, "LevelOnlySkipTime", parquet_profile, 1); |
108 | 113 | materialization_time = |
109 | 114 | ADD_CHILD_TIMER_WITH_LEVEL(profile, "MaterializationTime", parquet_profile, 1); |
110 | | - variant_reconstruction_time = add_persistent_counter(profile, "VariantReconstructionTime", |
111 | | - TUnit::TIME_NS, parquet_profile); |
112 | | - variant_reconstructed_rows = add_persistent_counter(profile, "VariantReconstructedRows", |
113 | | - TUnit::UNIT, parquet_profile); |
114 | | - variant_unshredded_direct_import_time = add_persistent_counter( |
| 115 | + auto variant = std::make_shared<ParquetVariantProfile>(); |
| 116 | + variant->variant_reconstruction_time = add_persistent_counter( |
| 117 | + profile, "VariantReconstructionTime", TUnit::TIME_NS, parquet_profile); |
| 118 | + variant->variant_reconstructed_rows = add_persistent_counter( |
| 119 | + profile, "VariantReconstructedRows", TUnit::UNIT, parquet_profile); |
| 120 | + variant->variant_unshredded_direct_import_time = add_persistent_counter( |
115 | 121 | profile, "VariantUnshreddedDirectImportTime", TUnit::TIME_NS, parquet_profile); |
116 | | - variant_unshredded_direct_import_rows = add_persistent_counter( |
| 122 | + variant->variant_unshredded_direct_import_rows = add_persistent_counter( |
117 | 123 | profile, "VariantUnshreddedDirectImportRows", TUnit::UNIT, parquet_profile); |
118 | | - variant_unshredded_direct_import_bytes = add_persistent_counter( |
| 124 | + variant->variant_unshredded_direct_import_bytes = add_persistent_counter( |
119 | 125 | profile, "VariantUnshreddedDirectImportBytes", TUnit::BYTES, parquet_profile); |
120 | | - variant_unshredded_direct_seek_time = add_persistent_counter( |
| 126 | + variant->variant_unshredded_direct_seek_time = add_persistent_counter( |
121 | 127 | profile, "VariantUnshreddedDirectSeekTime", TUnit::TIME_NS, parquet_profile); |
122 | | - variant_unshredded_direct_seek_rows = add_persistent_counter( |
| 128 | + variant->variant_unshredded_direct_seek_rows = add_persistent_counter( |
123 | 129 | profile, "VariantUnshreddedDirectSeekRows", TUnit::UNIT, parquet_profile); |
124 | | - variant_unshredded_direct_seek_bytes = add_persistent_counter( |
| 130 | + variant->variant_unshredded_direct_seek_bytes = add_persistent_counter( |
125 | 131 | profile, "VariantUnshreddedDirectSeekBytes", TUnit::BYTES, parquet_profile); |
126 | | - variant_unshredded_prefix_reuse_rows = add_persistent_counter( |
| 132 | + variant->variant_unshredded_prefix_reuse_rows = add_persistent_counter( |
127 | 133 | profile, "VariantUnshreddedPrefixReuseRows", TUnit::UNIT, parquet_profile); |
128 | | - variant_direct_subtree_rows = add_persistent_counter(profile, "VariantDirectSubtreeRows", |
129 | | - TUnit::UNIT, parquet_profile); |
130 | | - variant_direct_leaf_rows = |
| 134 | + variant->variant_direct_subtree_rows = add_persistent_counter( |
| 135 | + profile, "VariantDirectSubtreeRows", TUnit::UNIT, parquet_profile); |
| 136 | + variant->variant_direct_leaf_rows = |
131 | 137 | add_persistent_counter(profile, "VariantDirectLeafRows", TUnit::UNIT, parquet_profile); |
132 | | - variant_direct_leaf_path_misses = add_persistent_counter(profile, "VariantDirectLeafPathMisses", |
133 | | - TUnit::UNIT, parquet_profile); |
134 | | - variant_direct_leaf_residual_fallbacks = add_persistent_counter( |
| 138 | + variant->variant_direct_leaf_path_misses = add_persistent_counter( |
| 139 | + profile, "VariantDirectLeafPathMisses", TUnit::UNIT, parquet_profile); |
| 140 | + variant->variant_direct_leaf_residual_fallbacks = add_persistent_counter( |
135 | 141 | profile, "VariantDirectLeafResidualFallbacks", TUnit::UNIT, parquet_profile); |
136 | | - variant_direct_leaf_unsupported_fallbacks = add_persistent_counter( |
| 142 | + variant->variant_direct_leaf_unsupported_fallbacks = add_persistent_counter( |
137 | 143 | profile, "VariantDirectLeafUnsupportedFallbacks", TUnit::UNIT, parquet_profile); |
| 144 | + variant_counters = std::move(variant); |
138 | 145 | hybrid_selection_batches = ADD_CHILD_COUNTER_WITH_LEVEL(profile, "HybridSelectionBatches", |
139 | 146 | TUnit::UNIT, parquet_profile, 1); |
140 | 147 | hybrid_selection_ranges = ADD_CHILD_COUNTER_WITH_LEVEL(profile, "HybridSelectionRanges", |
@@ -363,20 +370,7 @@ ParquetColumnReaderProfile ParquetProfile::column_reader_profile() const { |
363 | 370 | .level_only_read_time = level_only_read_time, |
364 | 371 | .level_only_skip_time = level_only_skip_time, |
365 | 372 | .materialization_time = materialization_time, |
366 | | - .variant_reconstruction_time = variant_reconstruction_time, |
367 | | - .variant_reconstructed_rows = variant_reconstructed_rows, |
368 | | - .variant_unshredded_direct_import_time = variant_unshredded_direct_import_time, |
369 | | - .variant_unshredded_direct_import_rows = variant_unshredded_direct_import_rows, |
370 | | - .variant_unshredded_direct_import_bytes = variant_unshredded_direct_import_bytes, |
371 | | - .variant_unshredded_direct_seek_time = variant_unshredded_direct_seek_time, |
372 | | - .variant_unshredded_direct_seek_rows = variant_unshredded_direct_seek_rows, |
373 | | - .variant_unshredded_direct_seek_bytes = variant_unshredded_direct_seek_bytes, |
374 | | - .variant_unshredded_prefix_reuse_rows = variant_unshredded_prefix_reuse_rows, |
375 | | - .variant_direct_subtree_rows = variant_direct_subtree_rows, |
376 | | - .variant_direct_leaf_rows = variant_direct_leaf_rows, |
377 | | - .variant_direct_leaf_path_misses = variant_direct_leaf_path_misses, |
378 | | - .variant_direct_leaf_residual_fallbacks = variant_direct_leaf_residual_fallbacks, |
379 | | - .variant_direct_leaf_unsupported_fallbacks = variant_direct_leaf_unsupported_fallbacks, |
| 373 | + .variant_counters = variant_counters, |
380 | 374 | .hybrid_selection_batches = hybrid_selection_batches, |
381 | 375 | .hybrid_selection_ranges = hybrid_selection_ranges, |
382 | 376 | .hybrid_selection_null_fallback_batches = hybrid_selection_null_fallback_batches, |
|
0 commit comments