-
Notifications
You must be signed in to change notification settings - Fork 213
[AURON #1985] Optimize native metrics retrieval by passing keys directly #1982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -167,38 +167,50 @@ object NativeHelper extends Logging { | |
| }) | ||
| } | ||
|
|
||
| def getDefaultNativeMetrics(sc: SparkContext): Map[String, SQLMetric] = { | ||
| def metric(name: String) = SQLMetrics.createMetric(sc, name) | ||
| def nanoTimingMetric(name: String) = SQLMetrics.createNanoTimingMetric(sc, name) | ||
| def sizeMetric(name: String) = SQLMetrics.createSizeMetric(sc, name) | ||
|
|
||
| var metrics = TreeMap( | ||
| "stage_id" -> metric("stageId"), | ||
| "output_rows" -> metric("Native.output_rows"), | ||
| "output_batches" -> metric("Native.output_batches"), | ||
| "elapsed_compute" -> nanoTimingMetric("Native.elapsed_compute"), | ||
| "build_hash_map_time" -> nanoTimingMetric("Native.build_hash_map_time"), | ||
| "probed_side_hash_time" -> nanoTimingMetric("Native.probed_side_hash_time"), | ||
| "probed_side_search_time" -> nanoTimingMetric("Native.probed_side_search_time"), | ||
| "probed_side_compare_time" -> nanoTimingMetric("Native.probed_side_compare_time"), | ||
| "build_output_time" -> nanoTimingMetric("Native.build_output_time"), | ||
| "fallback_sort_merge_join_time" -> nanoTimingMetric("Native.fallback_sort_merge_join_time"), | ||
| "mem_spill_count" -> metric("Native.mem_spill_count"), | ||
| "mem_spill_size" -> sizeMetric("Native.mem_spill_size"), | ||
| "mem_spill_iotime" -> nanoTimingMetric("Native.mem_spill_iotime"), | ||
| "disk_spill_size" -> sizeMetric("Native.disk_spill_size"), | ||
| "disk_spill_iotime" -> nanoTimingMetric("Native.disk_spill_iotime"), | ||
| "shuffle_write_total_time" -> nanoTimingMetric("Native.shuffle_write_total_time"), | ||
| "shuffle_read_total_time" -> nanoTimingMetric("Native.shuffle_read_total_time")) | ||
|
|
||
| if (AuronAdaptor.getInstance.getAuronConfiguration.getBoolean( | ||
| SparkAuronConfiguration.INPUT_BATCH_STATISTICS_ENABLE)) { | ||
| metrics ++= TreeMap( | ||
| "input_batch_count" -> metric("Native.input_batches"), | ||
| "input_row_count" -> metric("Native.input_rows"), | ||
| "input_batch_mem_size" -> sizeMetric("Native.input_mem_bytes")) | ||
| private val defaultNativeMetricCreators: Map[String, SparkContext => SQLMetric] = Map( | ||
| "stage_id" -> (sc => SQLMetrics.createMetric(sc, "stageId")), | ||
| "output_rows" -> (sc => SQLMetrics.createMetric(sc, "Native.output_rows")), | ||
| "output_batches" -> (sc => SQLMetrics.createMetric(sc, "Native.output_batches")), | ||
| "elapsed_compute" -> (sc => SQLMetrics.createNanoTimingMetric(sc, "Native.elapsed_compute")), | ||
| "build_hash_map_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.build_hash_map_time")), | ||
| "probed_side_hash_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.probed_side_hash_time")), | ||
| "probed_side_search_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.probed_side_search_time")), | ||
| "probed_side_compare_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.probed_side_compare_time")), | ||
| "build_output_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.build_output_time")), | ||
| "fallback_sort_merge_join_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.fallback_sort_merge_join_time")), | ||
| "mem_spill_count" -> (sc => SQLMetrics.createMetric(sc, "Native.mem_spill_count")), | ||
| "mem_spill_size" -> (sc => SQLMetrics.createSizeMetric(sc, "Native.mem_spill_size")), | ||
| "mem_spill_iotime" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.mem_spill_iotime")), | ||
| "disk_spill_size" -> (sc => SQLMetrics.createSizeMetric(sc, "Native.disk_spill_size")), | ||
| "disk_spill_iotime" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.disk_spill_iotime")), | ||
| "shuffle_write_total_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.shuffle_write_total_time")), | ||
| "shuffle_read_total_time" -> (sc => | ||
| SQLMetrics.createNanoTimingMetric(sc, "Native.shuffle_read_total_time")), | ||
| "input_batch_count" -> (sc => SQLMetrics.createMetric(sc, "Native.input_batches")), | ||
| "input_row_count" -> (sc => SQLMetrics.createMetric(sc, "Native.input_rows")), | ||
| "input_batch_mem_size" -> (sc => SQLMetrics.createSizeMetric(sc, "Native.input_mem_bytes"))) | ||
|
|
||
| def getDefaultNativeMetrics(sc: SparkContext, keys: Set[String]): Map[String, SQLMetric] = { | ||
| val enabledKeys = | ||
| if (AuronAdaptor.getInstance.getAuronConfiguration.getBoolean( | ||
| SparkAuronConfiguration.INPUT_BATCH_STATISTICS_ENABLE)) { | ||
| keys | ||
| } else { | ||
| keys -- Set("input_batch_count", "input_row_count", "input_batch_mem_size") | ||
| } | ||
|
|
||
| TreeMap[String, SQLMetric]() ++ enabledKeys.iterator.flatMap { key => | ||
| defaultNativeMetricCreators.get(key).map(f => key -> f(sc)) | ||
| } | ||
| metrics | ||
| } | ||
|
|
||
| private def getDefaultNativeFileMetrics(sc: SparkContext): Map[String, SQLMetric] = { | ||
|
|
@@ -233,7 +245,8 @@ object NativeHelper extends Logging { | |
| } | ||
|
|
||
| def getNativeFileScanMetrics(sc: SparkContext): Map[String, SQLMetric] = TreeMap( | ||
| getDefaultNativeMetrics(sc) | ||
| .filterKeys(Set("stage_id", "output_rows", "elapsed_compute")) | ||
| .toSeq ++ getDefaultNativeFileMetrics(sc).toSeq: _*) | ||
| getDefaultNativeMetrics( | ||
| sc, | ||
| Set("stage_id", "output_rows", "elapsed_compute")).toSeq ++ getDefaultNativeFileMetrics( | ||
| sc).toSeq: _*) | ||
|
Comment on lines
247
to
+251
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.