alamb opened a new issue, #3190:
URL: https://github.com/apache/arrow-datafusion/issues/3190
**Describe the bug**
@syheliel reports the following errors:
```
1.
arrow-datafusion/datafusion/physical-expr/src/[planner.rs:54](http://planner.rs:54/)
if &variable_names[0][0..2] == "@@" {
2.
arrow-datafusion/datafusion/physical-expr/src/[planner.rs:1740](http://planner.rs:1740/)
if &var_names[0][0..1] == "@" {
```
Which will panic if the length of variable names is less than 2 characters.
These bugs can be fixed by using get(0..2) instead of [0..2] for a slice.
**To Reproduce**
Here is one reproducer:
```sql
❯ SELECT N | "". LT;
thread 'main' panicked at 'byte index 1 is out of bounds of ``',
library/core/src/str/mod.rs:107:9
stack backtrace:
0: rust_begin_unwind
at
/rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at
/rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
2: core::str::slice_error_fail_rt
at
/rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/str/mod.rs:107:9
3: core::ops::function::FnOnce::call_once
at
/rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/ops/function.rs:248:5
4: core::intrinsics::const_eval_select
at
/rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/intrinsics.rs:2376:5
5: core::str::slice_error_fail
...
```
**Expected behavior**
A valid error message rather than panic
**Additional context**
This is similar to https://github.com/apache/arrow-datafusion/issues/3137 /
fixed https://github.com/apache/arrow-datafusion/pull/3162
--
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]