| 540 | } |
| 541 | |
| 542 | pub fn create_expression_metrics( |
| 543 | &self, |
| 544 | metrics: &ExecutionPlanMetricsSet, |
| 545 | partition: usize, |
| 546 | ) -> ExpressionEvaluatorMetrics { |
| 547 | let labels: Vec<String> = self |
| 548 | .exprs |
| 549 | .iter() |
| 550 | .map(|proj_expr| { |
| 551 | let expr_sql = fmt_sql(proj_expr.expr.as_ref()).to_string(); |
| 552 | if proj_expr.expr.to_string() == proj_expr.alias { |
| 553 | expr_sql |
| 554 | } else { |
| 555 | format!("{expr_sql} AS {}", proj_expr.alias) |
| 556 | } |
| 557 | }) |
| 558 | .collect(); |
| 559 | ExpressionEvaluatorMetrics::new(metrics, partition, labels) |
| 560 | } |
| 561 | |
| 562 | /// Project statistics according to this projection. |
| 563 | /// For example, for a projection `SELECT a AS x, b + 1 AS y`, where `a` is at index 0 and `b` is at index 1, |