Skip to content

Commit 1738c3a

Browse files
winorosti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#49543
Signed-off-by: ti-chi-bot <[email protected]>
1 parent 27ee7b8 commit 1738c3a

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

expression/chunk_executor.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@
1515
package expression
1616

1717
import (
18+
<<<<<<< HEAD:expression/chunk_executor.go
1819
"github.com/pingcap/tidb/parser/ast"
1920
"github.com/pingcap/tidb/parser/mysql"
2021
"github.com/pingcap/tidb/sessionctx"
2122
"github.com/pingcap/tidb/types"
2223
"github.com/pingcap/tidb/util/chunk"
24+
=======
25+
"github.com/pingcap/tidb/pkg/parser/ast"
26+
"github.com/pingcap/tidb/pkg/parser/mysql"
27+
"github.com/pingcap/tidb/pkg/types"
28+
"github.com/pingcap/tidb/pkg/util/chunk"
29+
"github.com/pingcap/tidb/pkg/util/logutil"
30+
"go.uber.org/zap"
31+
>>>>>>> fb9d2203b99 (expression: enum/set could be invalid during evaluation (#49543)):pkg/expression/chunk_executor.go
2332
)
2433

2534
// Vectorizable checks whether a list of expressions can employ vectorized execution.
@@ -179,7 +188,19 @@ func evalOneVec(ctx sessionctx.Context, expr Expression, input *chunk.Chunk, out
179188
if result.IsNull(i) {
180189
buf.AppendNull()
181190
} else {
191+
<<<<<<< HEAD:expression/chunk_executor.go
182192
buf.AppendEnum(types.Enum{Value: 0, Name: result.GetString(i)})
193+
=======
194+
enum, err := types.ParseEnumName(ft.GetElems(), result.GetString(i), ft.GetCollate())
195+
if err != nil {
196+
logutil.BgLogger().Debug("Wrong enum name parsed during evaluation",
197+
zap.String("The name to be parsed in the ENUM", result.GetString(i)),
198+
zap.Strings("The valid names in the ENUM", ft.GetElems()),
199+
zap.Error(err),
200+
)
201+
}
202+
buf.AppendEnum(enum)
203+
>>>>>>> fb9d2203b99 (expression: enum/set could be invalid during evaluation (#49543)):pkg/expression/chunk_executor.go
183204
}
184205
}
185206
output.SetCol(colIdx, buf)
@@ -191,7 +212,19 @@ func evalOneVec(ctx sessionctx.Context, expr Expression, input *chunk.Chunk, out
191212
if result.IsNull(i) {
192213
buf.AppendNull()
193214
} else {
215+
<<<<<<< HEAD:expression/chunk_executor.go
194216
buf.AppendSet(types.Set{Value: 0, Name: result.GetString(i)})
217+
=======
218+
set, err := types.ParseSetName(ft.GetElems(), result.GetString(i), ft.GetCollate())
219+
if err != nil {
220+
logutil.BgLogger().Debug("Wrong set name parsed during evaluation",
221+
zap.String("The name to be parsed in the SET", result.GetString(i)),
222+
zap.Strings("The valid names in the SET", ft.GetElems()),
223+
zap.Error(err),
224+
)
225+
}
226+
buf.AppendSet(set)
227+
>>>>>>> fb9d2203b99 (expression: enum/set could be invalid during evaluation (#49543)):pkg/expression/chunk_executor.go
195228
}
196229
}
197230
output.SetCol(colIdx, buf)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
drop table if exists t01;
2+
CREATE TABLE `t01` (
3+
`6524d87a` timestamp DEFAULT '2024-10-02 01:54:55',
4+
`744e4d52` int(11) NOT NULL DEFAULT '2023959529',
5+
`087de3b2` varchar(122) DEFAULT '36h0hvfpylz0f0iv9h0ownfcg3rehi4',
6+
`26cbbf2a` enum('l7i9','3sdz3','83','4','92p','4g','8y5rn','7gp','7','1','e') NOT NULL DEFAULT '4',
7+
PRIMARY KEY (`744e4d52`,`26cbbf2a`) /*T![clustered_index] CLUSTERED */
8+
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci COMMENT='7ad99128'
9+
PARTITION BY HASH (`744e4d52`) PARTITIONS 9;
10+
insert ignore into t01 values ("2023-01-01 20:01:02", 123, 'abcd', '');
11+
select `t01`.`26cbbf2a` as r0 from `t01` where `t01`.`6524d87a` in ( '2010-05-25') or not( `t01`.`26cbbf2a` > '1' ) ;
12+
r0
13+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# https://github.com/pingcap/tidb/issues/49487
2+
drop table if exists t01;
3+
CREATE TABLE `t01` (
4+
`6524d87a` timestamp DEFAULT '2024-10-02 01:54:55',
5+
`744e4d52` int(11) NOT NULL DEFAULT '2023959529',
6+
`087de3b2` varchar(122) DEFAULT '36h0hvfpylz0f0iv9h0ownfcg3rehi4',
7+
`26cbbf2a` enum('l7i9','3sdz3','83','4','92p','4g','8y5rn','7gp','7','1','e') NOT NULL DEFAULT '4',
8+
PRIMARY KEY (`744e4d52`,`26cbbf2a`) /*T![clustered_index] CLUSTERED */
9+
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci COMMENT='7ad99128'
10+
PARTITION BY HASH (`744e4d52`) PARTITIONS 9;
11+
insert ignore into t01 values ("2023-01-01 20:01:02", 123, 'abcd', '');
12+
select `t01`.`26cbbf2a` as r0 from `t01` where `t01`.`6524d87a` in ( '2010-05-25') or not( `t01`.`26cbbf2a` > '1' ) ;

0 commit comments

Comments
 (0)