matthewmturner opened a new issue, #9558:
URL: https://github.com/apache/arrow-datafusion/issues/9558
### Is your feature request related to a problem or challenge?
In the telemetry we produce on query executions we sometimes need to know
the name of `ExecutionPlan` nodes (i.e. `ParquetExec`). Right now we do
something like the following to extract the name:
```
// Get the one-line representation of the ExecutionPlan, something like this:
// ParquetExec: file_groups=[...], ...
let mut buf = String::new();
write!(&mut buf, "{}", displayable(plan).one_line()).map_err(|e| {
DataFusionError::Internal(format!("Error while collecting metrics: {e}"))
})?;
let node_type = match buf.split_once(':') {
None => {
warn!("execution plan has unexpected display format: {buf}");
return Ok(true);
}
Some((name, _)) => name.to_string(),
};
```
From what I have seen the name of `ExecutionPlan` is always known at compile
time so I think this is unnecessary work and I am hoping to provide a simpler
way to get access to this information.
### Describe the solution you'd like
Could we add something like the following to `ExecutionPlan`
```
pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync {
const NAME: &'static str;
fn name(&self) -> &'static str {
return Self::NAME;
}
impl ExecutionPlan for ParquetExec {
const NAME = "ParquetExec";
// Rest of `ParquetExec` is unchanged
....
}
```
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
--
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]