neilconway opened a new issue, #20201:
URL: https://github.com/apache/datafusion/issues/20201
### Describe the bug
The input expression to `IS NULL` isn't type-checked, unless for other
constructs (`IS TRUE`, binary operators, etc.)
### To Reproduce
```
CREATE TABLE tt();
SELECT * FROM tt WHERE ((STARTS_WITH()) IS NULL);
```
Yields:
```
thread 'main' (41425691) panicked at
datafusion/functions/src/string/starts_with.rs:168:54:
index out of bounds: the len is 0 but the index is 1
stack backtrace:
0: __rustc::rust_begin_unwind
at
/rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/std/src/panicking.rs:698:5
1: core::panicking::panic_fmt
at
/rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:80:14
2: core::panicking::panic_bounds_check
at
/rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library/core/src/panicking.rs:276:5
3: <usize as core::slice::index::SliceIndex<[T]>>::index
at
/Users/neilconway/.rustup/toolchains/1.92.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:267:10
4: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
at
/Users/neilconway/.rustup/toolchains/1.92.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/slice/index.rs:18:15
5: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
at
/Users/neilconway/.rustup/toolchains/1.92.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:3628:9
6: <datafusion_functions::string::starts_with::StartsWithFunc as
datafusion_expr::udf::ScalarUDFImpl>::simplify
at ./datafusion/functions/src/string/starts_with.rs:168:54
```
### Expected behavior
The expected behavior is that `STARTS_WITH()` should be rejected at planning
time because of a type mismatch -- which is what happens for other variants
like `STARTS_WITH() IS TRUE`.
### 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]