diff --git a/expression/builtin_encryption_vec.go b/expression/builtin_encryption_vec.go index 4433463429127..1c2124b8c3001 100644 --- a/expression/builtin_encryption_vec.go +++ b/expression/builtin_encryption_vec.go @@ -567,6 +567,7 @@ func (b *builtinCompressSig) vecEvalString(input *chunk.Chunk, result *chunk.Col // According to doc: Empty strings are stored as empty strings. if len(strBytes) == 0 { result.AppendString("") + continue } compressed, err := deflate(strBytes) diff --git a/expression/integration_test.go b/expression/integration_test.go index e99b6a3db703c..d7a7717e5b34f 100644 --- a/expression/integration_test.go +++ b/expression/integration_test.go @@ -7078,3 +7078,16 @@ func TestIssue32488(t *testing.T) { tk.MustQuery("select binary upper(a), lower(a) from t order by upper(a);").Check([][]interface{}{{"İ i"}, {"Ʞ ʞ"}}) tk.MustQuery("select distinct upper(a), lower(a) from t order by upper(a);").Check([][]interface{}{{"İ i"}, {"Ʞ ʞ"}}) } + +func TestIssue33397(t *testing.T) { + store, clean := testkit.CreateMockStore(t) + defer clean() + + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test") + tk.MustExec("create table t(a varchar(32)) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;") + tk.MustExec("insert into t values(''), ('');") + tk.MustExec("set @@tidb_enable_vectorized_expression = true;") + result := tk.MustQuery("select compress(a) from t").Rows() + require.Equal(t, [][]interface{}{{""}, {""}}, result) +}