Skip to content

Commit 98267dd

Browse files
committed
expression: use hybrid check for ANY_VALUE string eval
1 parent 680f2bd commit 98267dd

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

pkg/expression/builtin_miscellaneous.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,11 @@ func (b *builtinIntAnyValueSig) evalInt(ctx EvalContext, row chunk.Row) (int64,
455455
}
456456

457457
func (b *builtinIntAnyValueSig) evalString(ctx EvalContext, row chunk.Row) (string, bool, error) {
458-
if b.tp.GetType() != mysql.TypeBit {
458+
if !b.tp.Hybrid() {
459459
return b.baseBuiltinFunc.evalString(ctx, row)
460460
}
461-
// ANY_VALUE preserves the TypeBit return field, but its primary evaluation signature is integer.
462-
// String contexts still need the underlying BIT value in its binary string form.
461+
// ANY_VALUE can preserve a hybrid return field while using the integer signature.
462+
// String contexts still need the underlying hybrid value in its string form.
463463
return b.args[0].EvalString(ctx, row)
464464
}
465465

pkg/expression/builtin_miscellaneous_vec.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"time"
2525

2626
"github.com/google/uuid"
27-
"github.com/pingcap/tidb/pkg/parser/mysql"
2827
"github.com/pingcap/tidb/pkg/sessionctx/variable"
2928
"github.com/pingcap/tidb/pkg/types"
3029
"github.com/pingcap/tidb/pkg/util/chunk"
@@ -367,7 +366,7 @@ func (b *builtinIntAnyValueSig) vecEvalInt(ctx EvalContext, input *chunk.Chunk,
367366
}
368367

369368
func (b *builtinIntAnyValueSig) vecEvalString(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
370-
if b.tp.GetType() != mysql.TypeBit {
369+
if !b.tp.Hybrid() {
371370
return b.baseBuiltinFunc.vecEvalString(ctx, input, result)
372371
}
373372
return b.args[0].VecEvalString(ctx, input, result)

0 commit comments

Comments
 (0)