You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "waynexia (via GitHub)" <gi...@apache.org> on 2023/03/02 08:21:14 UTC

[GitHub] [arrow-datafusion] waynexia opened a new issue, #5449: Add `name()` method to `UserDefinedLogicalNode`

waynexia opened a new issue, #5449:
URL: https://github.com/apache/arrow-datafusion/issues/5449

   **Is your feature request related to a problem or challenge? Please describe what you are trying to do.**
   A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for this feature, in addition to  the *what*)
   
   `ExtensionPlanner` convert extension `UserDefinedLogicalNode` to physical plan. But currently `UserDefinedLogicalNode` doesn't have a method to recognize which extension plan it is. So we have to write something like [this](https://github.com/GreptimeTeam/greptimedb/blob/56af23002c007ec84b6c2798e70acb59f3bd2781/src/promql/src/extension_plan/planner.rs#L31-L54):
   
   ```rust
           if let Some(node) = node.as_any().downcast_ref::<SeriesNormalize>() {
               Ok(Some(node.to_execution_plan(physical_inputs[0].clone())))
           } else if let Some(node) = node.as_any().downcast_ref::<InstantManipulate>() {
               Ok(Some(node.to_execution_plan(physical_inputs[0].clone())))
           } else if let Some(node) = node.as_any().downcast_ref::<RangeManipulate>() {
               Ok(Some(node.to_execution_plan(physical_inputs[0].clone())))
           } else if let Some(node) = node.as_any().downcast_ref::<SeriesDivide>() {
               Ok(Some(node.to_execution_plan(physical_inputs[0].clone())))
           } else if let Some(node) = node.as_any().downcast_ref::<EmptyMetric>() {
               Ok(Some(node.to_execution_plan()))
           } else {
               Ok(None)
           }
   ```
   
   **Describe the solution you'd like**
   A clear and concise description of what you want to happen.
   
   Add a new method to `UserDefinedLogicalNode` that allows it to state its name, like 
   ```rust
   pub trait UserDefinedLogicalNode {
     fn name(&self) -> &str;
   }
   ```
   Then the long if-else chain can be organized into `match`. It should be more clear.
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features you've considered.
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


-- 
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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] waynexia commented on issue #5449: Add `name()` method to `UserDefinedLogicalNode`

Posted by "waynexia (via GitHub)" <gi...@apache.org>.
waynexia commented on issue #5449:
URL: https://github.com/apache/arrow-datafusion/issues/5449#issuecomment-1451472680

   Another example from iox: https://github.com/influxdata/influxdb_iox/blob/f3267f992ae338973ea71df169b91015c6dc1473/iox_query/src/exec/context.rs#L94


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb closed issue #5449: Add `name()` method to `UserDefinedLogicalNode`

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #5449: Add `name()` method to `UserDefinedLogicalNode`
URL: https://github.com/apache/arrow-datafusion/issues/5449


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org