phillipleblanc commented on issue #13753:
URL: https://github.com/apache/datafusion/issues/13753#issuecomment-2541516448
AFAIK Rust doesn't allow downcasting from a `dyn` object to a trait (i.e.
`Unparseable`) - it needs to be the concrete type.
Creating a new `datafusion-unparser` crate makes sense to me, we could make
the builders public there. However, having a dependency from `datafusion-expr`
to `datafusion-unparser` still feels a bit weird (and also not possible due to
circular dependencies?). Perhaps instead of adding an `unparse` function on
`UserDefinedLogicalNode`, we could add a function registry on the `Unparser`
object that takes `UserDefinedLogicalNode` and tries to unparse it, similar to
how the optimizer rules work.
i.e.
```rust
pub trait UserDefinedLogicalNodeUnparser {
fn unparse(
&self,
node: &dyn UserDefinedLogicalNode,
query: &mut Option<QueryBuilder>,
select: &mut Option<SelectBuilder>,
relation: &mut Option<RelationBuilder>,
table_with_joins: &mut Option<TableWithJoinsBuilder>,
) -> Result<()>;
}
```
And then the `Unparser` has a `Vec<Arc<dyn UserDefinedLogicalNodeUnparser>>`
that it uses to try to unparse `UserDefinedLogicalNode`
--
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]