Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#54067
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
hawkingrei authored and ti-chi-bot committed Jun 21, 2024
1 parent 4ffd88c commit 6d9e336
Show file tree
Hide file tree
Showing 4 changed files with 941 additions and 0 deletions.
5 changes: 5 additions & 0 deletions expression/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,13 @@ func TestSubstituteCorCol2Constant(t *testing.T) {
plus3 := newFunction(ast.Plus, plus2, col1)
ret, err = SubstituteCorCol2Constant(plus3)
require.NoError(t, err)
<<<<<<< HEAD:expression/util_test.go
ans3 := newFunction(ast.Plus, ans1, col1)
require.True(t, ret.Equal(ctx, ans3))
=======
ans3 := newFunctionWithMockCtx(ast.Plus, ans1, col1)
require.False(t, ret.Equal(ctx, ans3))
>>>>>>> 1a24c032126 (expression: correct the erroneous scalar function equivalence check (#54067)):pkg/expression/util_test.go
}

func TestPushDownNot(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions parser/types/field_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,13 @@ func (ft *FieldType) Equal(other *FieldType) bool {
// When tp is float or double with decimal unspecified, do not check whether flen is equal,
// because flen for them is useless.
// The decimal field can be ignored if the type is int or string.
<<<<<<< HEAD:parser/types/field_type.go
tpEqual := (ft.tp == other.tp) || (ft.tp == mysql.TypeVarchar && other.tp == mysql.TypeVarString) || (ft.tp == mysql.TypeVarString && other.tp == mysql.TypeVarchar)
flenEqual := ft.flen == other.flen || (ft.EvalType() == ETReal && ft.decimal == UnspecifiedLength)
=======
tpEqual := (ft.GetType() == other.GetType()) || (ft.GetType() == mysql.TypeVarchar && other.GetType() == mysql.TypeVarString) || (ft.GetType() == mysql.TypeVarString && other.GetType() == mysql.TypeVarchar)
flenEqual := ft.flen == other.flen || (ft.EvalType() == ETReal && ft.decimal == UnspecifiedLength) || ft.EvalType() == ETJson
>>>>>>> 1a24c032126 (expression: correct the erroneous scalar function equivalence check (#54067)):pkg/parser/types/field_type.go
ignoreDecimal := ft.EvalType() == ETInt || ft.EvalType() == ETString
partialEqual := tpEqual &&
(ignoreDecimal || ft.decimal == other.decimal) &&
Expand Down
Loading

0 comments on commit 6d9e336

Please sign in to comment.