Acfboy commented on issue #20201:
URL: https://github.com/apache/datafusion/issues/20201#issuecomment-3889053305
Thanks to @Jefffrey , the problem is clear: `IS TRUE` and other similar
operatiors requires its input a specific type, so they invoke coercer like
`BinaryTypeCoercer` in `type_coercion.rs`. But `IS NULL` accepts any types so
its to nothing to check type.
```rust
| Expr::Column(_)
| Expr::ScalarVariable(_, _)
| Expr::Literal(_, _)
| Expr::SimilarTo(_)
| Expr::IsNotNull(_)
| Expr::IsNull(_)
| Expr::Negative(_)
| Expr::Cast(_)
| Expr::TryCast(_)
| Expr::Wildcard { .. }
| Expr::GroupingSet(_)
| Expr::Placeholder(_)
| Expr::OuterReferenceColumn(_, _) => Ok(Transformed::no(expr)),
```
Similar problems occur with some of the operators above. For example:
```
> SELECT * FROM tt WHERE ((STARTS_WITH()) SIMILAR TO '123');
thread 'main' (96331) panicked at
.../datafusion-functions-52.1.0/src/string/starts_with.rs:169:54:
index out of bounds: the len is 0 but the index is 1
```
I'd like to stop panicking in type_coercion.rs, and open another issue to
discuss about how to reject the cases at planning.
--
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]