waynexia commented on issue #2994:
URL:
https://github.com/apache/arrow-datafusion/issues/2994#issuecomment-1203421200
>It seems a little strange that self.name and self.get_type have different
behavior.
`Expr::name()` is nothing more than a string concat, it won't find whether
this column exists in schema. In other words, it won't return an error due to
the wrong schema or column:
```rust
fn create_name(e: &Expr, input_schema: &DFSchema) -> Result<String> {
match e {
Expr::Alias(_, name) => Ok(name.clone()),
Expr::Column(c) => Ok(c.flat_name()),
Expr::Literal(value) => Ok(format!("{:?}", value)),
Expr::BinaryExpr { left, op, right } => {
let left = create_name(left, input_schema)?;
let right = create_name(right, input_schema)?;
Ok(format!("{} {} {}", left, op, right))
}
.. => {}
}
```
But `get_type` and `get_nullable` can't. The type and nullable info are
stored in schema.
BTW, It looks like the `input_schema` is not used in this function. Maybe we
can remove it.
--
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]