parthchandra commented on code in PR #4075:
URL: https://github.com/apache/datafusion-comet/pull/4075#discussion_r3140601757
##########
native/core/src/execution/metrics/utils.rs:
##########
@@ -68,18 +63,24 @@ pub(crate) fn to_native_metric_node(
Some(metrics.aggregate_by_name())
};
- // add metrics
- node_metrics
- .unwrap_or_default()
- .iter()
- .map(|m| m.value())
- .map(|m| (m.name(), m.as_usize() as i64))
- .for_each(|(name, value)| {
- native_metric_node.metrics.insert(name.to_string(), value);
- });
+ let children = spark_plan.children();
+ let mut native_metric_node = NativeMetricNode {
+ // Most operator metric maps are well under 20 entries (e.g.
hash-join: 9,
+ // native-scan: ~20). Pre-sizing to 16 avoids the default-capacity
rehash.
+ metrics: HashMap::with_capacity(16),
Review Comment:
nit: use a constant for readability?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]