Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expression: enum/set could be invalid during evaluation #49543

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions pkg/expression/chunk_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
package expression

import (
"github.com/pingcap/errors"
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tidb/pkg/sessionctx"
"github.com/pingcap/tidb/pkg/types"
"github.com/pingcap/tidb/pkg/util/chunk"
"github.com/pingcap/tidb/pkg/util/logutil"
"go.uber.org/zap"
)

// Vectorizable checks whether a list of expressions can employ vectorized execution.
Expand Down Expand Up @@ -182,7 +183,11 @@ func evalOneVec(ctx sessionctx.Context, expr Expression, input *chunk.Chunk, out
} else {
enum, err := types.ParseEnumName(ft.GetElems(), result.GetString(i), ft.GetCollate())
if err != nil {
return errors.Errorf("Wrong enum value parsed during evaluation")
logutil.BgLogger().Debug("Wrong enum name parsed during evaluation",
zap.String("The name to be parsed in the ENUM", result.GetString(i)),
zap.Strings("The valid names in the ENUM", ft.GetElems()),
zap.Error(err),
)
}
buf.AppendEnum(enum)
}
Expand All @@ -198,7 +203,11 @@ func evalOneVec(ctx sessionctx.Context, expr Expression, input *chunk.Chunk, out
} else {
set, err := types.ParseSetName(ft.GetElems(), result.GetString(i), ft.GetCollate())
if err != nil {
return errors.Errorf("Wrong set value parsed during evaluation")
logutil.BgLogger().Debug("Wrong set name parsed during evaluation",
zap.String("The name to be parsed in the SET", result.GetString(i)),
zap.Strings("The valid names in the SET", ft.GetElems()),
zap.Error(err),
)
}
buf.AppendSet(set)
}
Expand Down