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

planner: fix range partition prune with an unsigned column (#50113) #50192

Open
wants to merge 1 commit into
base: release-5.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions expression/builtin_compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -2626,6 +2626,7 @@ func (b *builtinNullEQIntSig) evalInt(row chunk.Row) (val int64, isNull bool, er
case isNull0 && isNull1:
res = 1
case isNull0 != isNull1:
<<<<<<< HEAD:expression/builtin_compare.go
break
case isUnsigned0 && isUnsigned1 && types.CompareUint64(uint64(arg0), uint64(arg1)) == 0:
res = 1
Expand All @@ -2643,6 +2644,11 @@ func (b *builtinNullEQIntSig) evalInt(row chunk.Row) (val int64, isNull bool, er
break
}
if types.CompareInt64(arg0, arg1) == 0 {
=======
return res, false, nil
default:
if types.CompareInt(arg0, isUnsigned0, arg1, isUnsigned1) == 0 {
>>>>>>> 7893f1637e1 (planner: fix range partition prune with an unsigned column (#50113)):pkg/expression/builtin_compare.go
res = 1
}
}
Expand Down Expand Up @@ -2944,6 +2950,7 @@ func CompareInt(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsR
return compareNull(isNull0, isNull1), true, nil
}

<<<<<<< HEAD:expression/builtin_compare.go
isUnsigned0, isUnsigned1 := mysql.HasUnsignedFlag(lhsArg.GetType().Flag), mysql.HasUnsignedFlag(rhsArg.GetType().Flag)
var res int
switch {
Expand All @@ -2965,6 +2972,10 @@ func CompareInt(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsR
res = types.CompareInt64(arg0, arg1)
}
return int64(res), false, nil
=======
isUnsigned0, isUnsigned1 := mysql.HasUnsignedFlag(lhsArg.GetType().GetFlag()), mysql.HasUnsignedFlag(rhsArg.GetType().GetFlag())
return int64(types.CompareInt(arg0, isUnsigned0, arg1, isUnsigned1)), false, nil
>>>>>>> 7893f1637e1 (planner: fix range partition prune with an unsigned column (#50113)):pkg/expression/builtin_compare.go
}

func genCompareString(collation string) func(sctx sessionctx.Context, lhsArg Expression, rhsArg Expression, lhsRow chunk.Row, rhsRow chunk.Row) (int64, bool, error) {
Expand Down
Loading