pingcap / pingcap/tidb

Expression evaluation panic: baseBuiltinFunc.vecEvalString() should never be called when AES_ENCRYPT takes a vectorized FLOAT CASE expression

Open
#67,075 3 comments 0 reactions 1 assignee Claimed by @ckstck View on GitHub
contribution may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report
When executing a query that passes a vectorized FLOAT column via a CASE expression as the key to the AES_ENCRYPT function, the TiDB vectorized execution engine panics with ERROR 1105 (HY000): baseBuiltinFunc.vecEvalString() should never be called.

This issue is strictly related to the BIT data type handling in the vectorized execution engine. If the column is changed to FLOAT or INT, the panic does not occur. It appears that the vectorized evaluator for the CASE expression (involving a negative integer and a BIT column) lacks a proper vecEvalString implementation when coerced into a string context by AES_ENCRYPT.

### 1. Minimal reproduce step (Required)

``` sql
CREATE TABLE t48 (c1 BIT NOT NULL);
INSERT INTO t48 (c1) VALUES (b'0');

SELECT AES_ENCRYPT(COT(-9749), CASE -65 WHEN c1 THEN c1 END) FROM t48;
```

### 2. What did you expect to see? (Required)
The query should execute successfully by performing a proper implicit type conversion from BIT/numeric to String for the AES_ENCRYPT function, or throw a standard SQL type mismatch error, rather than crashing the execution engine with an internal assertion panic.

### 3. What did you see instead (Required)
`ERROR 1105 (HY000): baseBuiltinFunc.vecEvalString() should never be called, please contact the TiDB team for help`
### 4. What is your TiDB version? (Required)
``` sql
| Release Version: v8.5.5
Edition: Community
Git Commit Hash: 1fa258b833ff113883beeba40bc130be7ce66610
Git Branch: HEAD
UTC Build Time: 2026-01-14 22:19:19
GoVersion: go1.25.5
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.