diff --git a/pkg/sql/plan/function/operator/coalesce.go b/pkg/sql/plan/function/operator/coalesce.go index bdf154ec07e2eed2abfeea1ddcfde68d147c6408..a8e4729c6292530ac1253cf0dd501f2f2f74c587 100644 --- a/pkg/sql/plan/function/operator/coalesce.go +++ b/pkg/sql/plan/function/operator/coalesce.go @@ -245,7 +245,7 @@ func coalesceString(vs []*vector.Vector, proc *process.Process, typ types.Type) for j := 0; j < vecLen; j++ { if rs.Nsp.Contains(uint64(j)) { - copy(dataVec[j], cols.Data) + dataVec[j] = append(dataVec[j], cols.Data...) } } rs.Nsp.Np = nil diff --git a/test/cases/function/func_coalesce_1.sql b/test/cases/function/func_coalesce_1.sql index c20fe5c732f7211ab4156fec1052aee82db6c59c..3d783f51c93119a5bf3d92d759800b003191110d 100644 --- a/test/cases/function/func_coalesce_1.sql +++ b/test/cases/function/func_coalesce_1.sql @@ -17,9 +17,7 @@ select coalesce(a, 1) from t1; -- echo error select coalesce(b, 1) from t1; --- @bvt:issue#4744 select coalesce(b, '1') from t1; --- @bvt:issue drop table t1; @@ -39,11 +37,9 @@ select * from t2; select coalesce(a, 1.0) from t2; select coalesce(a, 1) from t2; --- @bvt:issue#4744 select coalesce(b, 2022-01-01) from t2; select coalesce(b, 2022) from t2; select coalesce(b, 2) from t2; --- @bvt:issue select coalesce(b, '2022-10-01') from t2; @@ -76,10 +72,8 @@ select coalesce(a, 0) from t3; -- echo error select coalesce(a, 200) from t3; --- @bvt:issue#4744 select coalesce(b, '1') from t3; select coalesce(b, 'bull') from t3; --- @bvt:issue drop table t3; diff --git a/test/result/function/func_coalesce_1.result b/test/result/function/func_coalesce_1.result index d2d6e54652e51fefb992725fda80d9fd0e75e510..0cee9ea2f9bf7df25c2107586a331376e207dc8f 100644 --- a/test/result/function/func_coalesce_1.result +++ b/test/result/function/func_coalesce_1.result @@ -24,8 +24,8 @@ Can't cast column from VARCHAR type to BIGINT type because of one or more values select coalesce(b, '1') from t1; coalesce(b, 1) a - - +1 +1 b drop table t1; drop table if exists t2; @@ -58,21 +58,21 @@ coalesce(a, 1) select coalesce(b, 2022-01-01) from t2; coalesce(b, 2022 - 1 - 1) 2022-02-20 10:10:11 - +2020 2023-04-03 22:10:30 - +2020 select coalesce(b, 2022) from t2; coalesce(b, 2022) 2022-02-20 10:10:11 - +2022 2023-04-03 22:10:30 - +2022 select coalesce(b, 2) from t2; coalesce(b, 2) 2022-02-20 10:10:11 - +2 2023-04-03 22:10:30 - +2 select coalesce(b, '2022-10-01') from t2; coalesce(b, 2022-10-01) 2022-02-20 10:10:11 @@ -128,15 +128,15 @@ coalesce(b, 1) a b c - - +1 +1 select coalesce(b, 'bull') from t3; coalesce(b, bull) a b c - - +bull +bull drop table t3; drop table if exists t4; create table t4 (f1 date, f2 datetime, f3 varchar(20));