@@ -1024,10 +1024,14 @@ func (b *builtinLpadSig) vecEvalString(ctx EvalContext, input *chunk.Chunk, resu
1024
1024
strLength := len (str )
1025
1025
padStr := padBuf .GetString (i )
1026
1026
padLength := len (padStr )
1027
- if targetLength < 0 || targetLength > b .tp .GetFlen () || ( strLength < targetLength && padLength == 0 ) {
1027
+ if targetLength < 0 || targetLength > b .tp .GetFlen () {
1028
1028
result .AppendNull ()
1029
1029
continue
1030
1030
}
1031
+ if strLength < targetLength && padLength == 0 {
1032
+ result .AppendString ("" )
1033
+ continue
1034
+ }
1031
1035
if tailLen := targetLength - strLength ; tailLen > 0 {
1032
1036
repeatCount := tailLen / padLength + 1
1033
1037
str = strings .Repeat (padStr , repeatCount )[:tailLen ] + str
@@ -1095,10 +1099,14 @@ func (b *builtinLpadUTF8Sig) vecEvalString(ctx EvalContext, input *chunk.Chunk,
1095
1099
runeLength := len ([]rune (str ))
1096
1100
padLength := len ([]rune (padStr ))
1097
1101
1098
- if targetLength < 0 || targetLength * 4 > b .tp .GetFlen () || ( runeLength < targetLength && padLength == 0 ) {
1102
+ if targetLength < 0 || targetLength * 4 > b .tp .GetFlen () {
1099
1103
result .AppendNull ()
1100
1104
continue
1101
1105
}
1106
+ if runeLength < targetLength && padLength == 0 {
1107
+ result .AppendString ("" )
1108
+ continue
1109
+ }
1102
1110
if tailLen := targetLength - runeLength ; tailLen > 0 {
1103
1111
repeatCount := tailLen / padLength + 1
1104
1112
str = string ([]rune (strings .Repeat (padStr , repeatCount ))[:tailLen ]) + str
@@ -1485,10 +1493,14 @@ func (b *builtinRpadSig) vecEvalString(ctx EvalContext, input *chunk.Chunk, resu
1485
1493
strLength := len (str )
1486
1494
padStr := padBuf .GetString (i )
1487
1495
padLength := len (padStr )
1488
- if targetLength < 0 || targetLength > b .tp .GetFlen () || ( strLength < targetLength && padLength == 0 ) {
1496
+ if targetLength < 0 || targetLength > b .tp .GetFlen () {
1489
1497
result .AppendNull ()
1490
1498
continue
1491
1499
}
1500
+ if strLength < targetLength && padLength == 0 {
1501
+ result .AppendString ("" )
1502
+ continue
1503
+ }
1492
1504
if tailLen := targetLength - strLength ; tailLen > 0 {
1493
1505
repeatCount := tailLen / padLength + 1
1494
1506
str = str + strings .Repeat (padStr , repeatCount )
@@ -2619,10 +2631,14 @@ func (b *builtinRpadUTF8Sig) vecEvalString(ctx EvalContext, input *chunk.Chunk,
2619
2631
runeLength := len ([]rune (str ))
2620
2632
padLength := len ([]rune (padStr ))
2621
2633
2622
- if targetLength < 0 || targetLength * 4 > b .tp .GetFlen () || ( runeLength < targetLength && padLength == 0 ) {
2634
+ if targetLength < 0 || targetLength * 4 > b .tp .GetFlen () {
2623
2635
result .AppendNull ()
2624
2636
continue
2625
2637
}
2638
+ if runeLength < targetLength && padLength == 0 {
2639
+ result .AppendString ("" )
2640
+ continue
2641
+ }
2626
2642
if tailLen := targetLength - runeLength ; tailLen > 0 {
2627
2643
repeatCount := tailLen / padLength + 1
2628
2644
str = str + strings .Repeat (padStr , repeatCount )
0 commit comments