databend
databend copied to clipboard
bug: nested `try_cast` in having cause panic
Search before asking
- [X] I had searched in the issues and found no similar issues.
Version
v1.2.314-nightly
What's Wrong?
nested try_cast
in having cause panic
panicked at src/query/expression/src/evaluator.rs:593:58:
called `Option::unwrap()` on a `None` value
How to Reproduce?
mysql> create table test(a int not null, b timestamp not null);
Query OK, 0 rows affected (0.13 sec)
mysql> insert into test values(1, '2024-01-01');
Query OK, 1 row affected (0.10 sec)
mysql> select * from test having try_cast(b as boolean);
ERROR 1105 (HY000): BadArguments. Code: 1006, Text = error:
--> SQL:1:36
|
1 | select * from test having try_cast(b as boolean)
| ^ unable to cast type `Timestamp` to type `Boolean NULL`
mysql> select * from test having try_cast(try_cast(b as timestamp null) as boolean);
ERROR 1105 (HY000): StorageOther. Code: 4000, Text = segment pruning failure, task 47868 panicked.
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!