## What have you changed? (mandatory)
Execute below SQL will panic
```SQL
create TABLE t1 (col1 int) partition by range(case when col1>0 then 10 else 20 end) (partition p0 values less than (2), partition p1 values less than (6));
```
TODO:
This PR just fix the panic, This SQL should return err:` ERROR 1564 (HY000): This partition function is not allowed`, issue[#7058](https://github.com/pingcap/tidb/issues/7058)
## What is the type of the changes? (mandatory)
Bug fix
## How has this PR been tested? (mandatory)
Unit test
## Does this PR affect documentation (docs/docs-cn) update? (mandatory)
No
## Does this PR affect tidb-ansible update? (mandatory)
No
## Does this PR need to be added to the release notes? (mandatory)
## Refer to a related PR or issue link (optional)
## Benchmark result if necessary (optional)
## Add a few positive/negative examples (optional)