From 46fa53142822d3a756113636a1695e54dff24030 Mon Sep 17 00:00:00 2001 From: YangKeao Date: Mon, 13 May 2024 21:14:41 +0800 Subject: [PATCH] expression: clarify the `cast(... as char array)` error message (#53220) close pingcap/tidb#53219 --- pkg/expression/builtin_cast.go | 2 +- tests/integrationtest/r/expression/multi_valued_index.result | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/expression/builtin_cast.go b/pkg/expression/builtin_cast.go index 3cc488a4962ef..3aac238d86e10 100644 --- a/pkg/expression/builtin_cast.go +++ b/pkg/expression/builtin_cast.go @@ -455,7 +455,7 @@ func (c *castAsArrayFunctionClass) getFunction(ctx BuildContext, args []Expressi return nil, ErrNotSupportedYet.GenWithStackByArgs("specifying charset for multi-valued index") } if arrayType.EvalType() == types.ETString && arrayType.GetFlen() == types.UnspecifiedLength { - return nil, ErrNotSupportedYet.GenWithStackByArgs("CAST-ing data to array of char/binary BLOBs") + return nil, ErrNotSupportedYet.GenWithStackByArgs("CAST-ing data to array of char/binary BLOBs with unspecified length") } bf, err := newBaseBuiltinFunc(ctx, c.funcName, args, c.tp) diff --git a/tests/integrationtest/r/expression/multi_valued_index.result b/tests/integrationtest/r/expression/multi_valued_index.result index 996b530da5a6e..52d40e6c115e4 100644 --- a/tests/integrationtest/r/expression/multi_valued_index.result +++ b/tests/integrationtest/r/expression/multi_valued_index.result @@ -28,9 +28,9 @@ Error 1235 (42000): This version of TiDB doesn't yet support 'Use of CAST( .. AS create table t(j json, gc json as (cast(j->'$[*]' as unsigned array))); Error 1235 (42000): This version of TiDB doesn't yet support 'Use of CAST( .. AS .. ARRAY) outside of functional index in CREATE(non-SELECT)/ALTER TABLE or in general expressions' create table t1(j json, key i1((cast(j->"$" as char array)))); -Error 1235 (42000): This version of TiDB doesn't yet support 'CAST-ing data to array of char/binary BLOBs' +Error 1235 (42000): This version of TiDB doesn't yet support 'CAST-ing data to array of char/binary BLOBs with unspecified length' create table t1(j json, key i1((cast(j->"$" as binary array)))); -Error 1235 (42000): This version of TiDB doesn't yet support 'CAST-ing data to array of char/binary BLOBs' +Error 1235 (42000): This version of TiDB doesn't yet support 'CAST-ing data to array of char/binary BLOBs with unspecified length' create table t1(j json, key i1((cast(j->"$" as float array)))); Error 1235 (42000): This version of TiDB doesn't yet support 'CAST-ing data to array of float BINARY' create table t1(j json, key i1((cast(j->"$" as decimal(4,2) array))));